How can you set the -R in your LESS environment variable?
Best Answer
Taken from the manpage:
Options are also taken from the environment variable "LESS".
For example, to avoid typing "less -options ..."
each time less is invoked,
you might tell csh:
setenv LESS "-options"
or if you use sh:
LESS="-options"; export LESS
If you are using Bash which is the default on a variety of distributions we can therefore do:
export LESS="-R"
If you want to make this permanent across shell/login sessions then you need to add the command(s) above to the appropriate file, with Bash as the example again you'd open up $HOME/.bashrc with a text editor and drop in the export command. This means each time Bash invokes it will run the export command, setting your Less preferences.
You can switch to another shell and continue working on something else while the output completes and has the added advantage that the output will not be sent to your remote link if you are not watching it.
There is also support for buffer scrollback in screen, so you can page or search through the output when it is done.
If you are not using screen, ^C is not responding and you really need to terminate the job, you may want to try '~.' (the default ssh interrupt) to terminate the ssh session. You may need to hit enter before typing '~.'
G goes to the bottom of the file
^b goes up one page
? searches backwards.
As you said, you can open the file with +G and then use ? and ^b to scroll up. There are likely clever awk things you can do to achieve the same thing in a script.
Best Answer
Taken from the manpage:
If you are using Bash which is the default on a variety of distributions we can therefore do:
If you want to make this permanent across shell/login sessions then you need to add the command(s) above to the appropriate file, with Bash as the example again you'd open up $HOME/.bashrc with a text editor and drop in the export command. This means each time Bash invokes it will run the export command, setting your Less preferences.
Hope that helps :-)