New answers tagged less
0
Try these commands to generate man output without a pager.
man ls | cat (generated fixed width)
man -P cat ls (generated variable width)
I was on a GNU linux system
2
diff cannot output colors, you need another program, such as colordiff for that. Colors in the terminal are printed via ANSI escape codes which less does not interpret by default. To get less to correctly show colors, you need the -r, or even better, -R switch:
colordiff $file1 $file2 | less -R
From man less:
-R or --RAW-CONTROL-CHARS
Like ...
1
To pipe colored diff to less:
diff $file1 $file2 | colordiff | less -r
To make it more readable, by limiting it to a single screen:
diff -uw $file1 $file2 | colordiff | less -r
And, to cause less not to display if there is only one screens worth of content:
diff -uw $file1 $file2 | tee /dev/stderr | colordiff | less -r -F
The -F causes less to close ...
4
Use less -FX. From man less:
-F or --quit-if-one-screen
Causes less to automatically exit if the entire file can be dis-
played on the first screen.
-X or --no-init
Disables sending the termcap initialization and deinitialization
strings to the terminal. This is sometimes desirable if the
...
4
Use less --follow-name if your version of less supports it. That option was introduced in version 416.
0
I just found the answer in this U&L Q&A titled: How to do a tail -f of log rotated files?.
Using tail:
(if installing GNU tail on your system is an option)
tail -F program.log
From the tail man page:
-f, --follow[={name|descriptor}]
output appended data as the file grows; -f,
--follow, and --follow=descriptor ...
Top 50 recent answers are included

