LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-04-2012, 10:08 PM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,830
Blog Entries: 21

Rep: Reputation: 119Reputation: 119
more or less - but less does not keep its output on the screen


When I run the "more" command, scroll down some, then press "q" to quit, I still see the file contents I scrolled to. But with "less" it erases it and restores the screen. I'd like to have a scroller program for the command line that goes up and down like "less", but keeps the last contents on the screen when quitting like "more". There does not appear to be an option on "less" to revert to the traditional behavior of "more".

Is there such an alternate program? If not, and if I decide to modify "less" to add this, what would you suggest the command line option or command control letter to be?
 
Old 04-04-2012, 10:22 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Have you tried adding:

Code:
export LESS_IS_MORE=1
.. to your environment? .. it doesn't behave quite the same as standard less but it does do specifically what you asked for.
 
Old 04-04-2012, 10:29 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,137
Blog Entries: 2

Rep: Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840Reputation: 4840
Start less with the -X option and the output screen will not be reset when exiting less. For convenience reasons I would recommend to create an alias for that. As always, for more info on less try
Code:
man less
 
1 members found this post helpful.
Old 04-05-2012, 01:13 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,577

Rep: Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816Reputation: 2816
maybe cat?
 
Old 04-05-2012, 07:13 PM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,830
Blog Entries: 21

Original Poster
Rep: Reputation: 119Reputation: 119
cat just blew through the whole file hyper fast. It's useful for very small files that fit one screenful.

export LESS_IS_MORE=1 did not accomplish anything

less -X did work. Now I wonder how I missed that on the man page because it is there. Maybe because they didn't label it as "do not clear the screen" and instead started out about some kind of initialization.
 
Old 04-05-2012, 11:57 PM   #6
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Hmm .. must be a version thing, I'm running 444
 
Old 04-06-2012, 10:10 AM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,516

Rep: Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545Reputation: 1545
You can also export an environment variable "LESS" with whatever flags you typically want. I use
Code:
export LESS=-isXM
 
2 members found this post helpful.
Old 04-07-2012, 03:36 AM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: WV, USA
Distribution: Slackware, Ubuntu, Amazon Linux
Posts: 1,830
Blog Entries: 21

Original Poster
Rep: Reputation: 119Reputation: 119
Quote:
Originally Posted by kbp View Post
Hmm .. must be a version thing, I'm running 444
I have less 436 on Ubuntu 10.10 and less 443 on Slackware 13.37.

The real problem was me not reading the man page correctly. I did look for such an option, but missed -X probably because I read about 1 line worth of description for each option, missing the semantics of -X which wasn't in that first line of the option description. I didn't grok the "initialization" stuff as meaning this.

I ... must practice to read man pages more slowly.

Last edited by Skaperen; 04-07-2012 at 03:37 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard script output to screen & -x option output to file BoBeau236 Programming 6 05-10-2011 07:43 AM
Dual Screen, Output VGA Monitor and Laptop Screen Problems yukapuka Linux - Laptop and Netbook 2 07-24-2009 02:25 AM
Output Redirection - Trying to output to screen and file? helptonewbie Linux - Newbie 7 03-19-2009 07:05 AM
Output ls one screen at a time anjanesh Linux - Newbie 10 01-03-2006 04:50 AM
output to screen from a deamon csfalcon Programming 10 04-22-2005 02:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration