less is a terminal pager program used to view (but not change) the contents of a text file one screen at a time.
15
votes
4answers
848 views
How can I use man without less?
By default, man uses less to output text. How can I tell it to just output to stdout? My terminal emulator has a scroll bar and search function and I want to use those instead of the arrow keys.
3
votes
4answers
110 views
Colored output in less when tailing a logfile
I am in dire need of a way to color my less output while reading a file that is constantly being appended.
The file in questions is a Resin servlet container log.
My current "implementation" of the ...
1
vote
2answers
51 views
How do I pipe colored diff output to less?
I've been using git diff, which produces colored output. However, I now find I need to use ordinary diff for something, and it's producing a lot of output that is hard to read because of the lack of ...
2
votes
1answer
45 views
Making less print to stdout if an entire file can be displayed on one screen
When more is passed a file whose contents can be displayed on one screen, it just writes the file's contents to stdout without pagination. If the file cannot fit on one screen, more paginates it.
...
2
votes
1answer
25 views
Making less's follow option show line movement
I often find myself using less to display log files that contain hundreds of
contiguous, identical lines that are appended to the files at set intervals.
For example,
something happened
something ...
11
votes
7answers
2k views
Isn't less just more?
When I do more filename and less filename, it would seem that the resulting terminals are quite similar. I can navigate and search through my files identically (j, Space, /pattern, etc.).
I find it ...
11
votes
1answer
1k views
The 'less' command-line equivalent of 'tail -f'
I would like to open up a file using less, and have it automatically scroll the file similar to tail -f.
I know that I can do less file, and then hit Shift-F to forward forever; like tail -f.
I want ...
4
votes
2answers
87 views
How do I less a filename rather than an inode number?
I have a piece of software that rotates its log files when it restarts. However, during development, I am restarting it a lot, so I would like to monitor the latest log file at any time.
If I start ...
11
votes
4answers
2k views
Colors in Man Pages
When I look at a man page in my 'console' (not an xterm) I see some coloration, but I don't get this in my xterm's (e.g. konsole) is there any way I can enable this? hopefully a fairly simple ...
2
votes
2answers
40 views
Stop Git submodule foreach from opening less for each module
I occasionally need to grep through git submodules for which I use:
git submodule foreach 'git grep x'
However, since switching to zsh I find a less prompt is opened for each submodule, even when ...
22
votes
13answers
2k views
Is there ever a reason to use `cat` when you've got `less`?
I used to use cat to view files. Then I learned that less is usually better, and is a must if the file is longer than a few dozen rows.
My question: Is there ever a reason to use cat instead of less? ...
8
votes
2answers
805 views
How can I view gzipped files in less without having to type zless?
I am using Ubuntu, and I would like to be able to type less compressed_text_file.gz and page the contents of the text file in uncompressed form. Is there a way to do this?
1
vote
1answer
104 views
Is GREP_OPTIONS= --color=always ignored?
I was playing around with setting GREP_OPTIONS and couldn't get it to work. Just curious as to why.
Simple test commands output:
richard@ubuntu:~$ echo $GREP_OPTIONS
richard@ubuntu:~$
...
2
votes
0answers
64 views
Using Unison with colordiff
I want Unison to show the diffs with colordiff.
I’ve got diff = colordiff -u CURRENT2 CURRENT1 | less -R in my config file but it seems like Unison pipes the output to plain less nonetheless, so I ...
21
votes
3answers
5k views
Can less retain colored output?
Can I get less not to monochrome its output?
E.g., the output from git diff is colored, but git diff | less is not.
2
votes
0answers
75 views
Command-line file reader (like “less”) that can tell the line where the user stopped reading
[Context] I'm developing a little app, as a hobby to learn ncurses, that catalogs and lists and searches within a set of documents (for now, they are the HOWTOs from TLDP).
The most tricky part of ...
3
votes
1answer
95 views
How to scroll large datafile while keeping header
Suppose I have some large datafile, which overflow the screen in both vertical and horizontal direction. How can I browse this file, while the header-lines stay on the screen?
For the moment, I am ...
5
votes
2answers
108 views
How to set up hjkl for less?
less already uses j/k for vertical scrolling, but not h/l for horizontal scrolling (in --ch mode). The l key isn't bound to anything anyway, and h is just a synonym for H, so I wouldn't overwrite any ...
19
votes
7answers
11k views
Is there a way to dynamically refresh the less command?
I like the watch command, but it has its limitations.
I'm curious to know whether I could mimic the functionality of watch with less. I'm mainly looking for the ability to scroll through my directory ...
3
votes
1answer
121 views
Why doesn't “cvs --help | less” work?
I don't know why, but piping cvs --help to less doesn't work. Probably it's because cvs --help outputs not to standard output(1) or error output(2), but somewhere else. Could you tell me where does it ...
4
votes
1answer
299 views
Instant search in less command? (Similar to incsearch in VIM)
Is there a way to search, while I'm typing in less? Just like the vim option, set incsearch.
As I didn't find a proper way to do it, is there any similar tool that can do it?
8
votes
2answers
592 views
How to have tail -f show colored output with vim?
In this question, Gilles answered
Yet another possibility is to run tail -f in an Emacs shell buffer and use Emacs's syntax coloring abilities.
Because I'm a vim user, I'd like to do this with ...
6
votes
1answer
548 views
Get colors in less command with ccze: Shift + g doesn't go to the end of file?
In all the tools to get colors with less command: -R, Pygments, GNU Source-highlight, vless, ... ccze make me sastified with below command:
ccze -A < /path/to/log/file | less -R
but Shift+g ...
4
votes
3answers
320 views
Piping into less and editing: “cannot edit standard input” error. Workarounds?
I recently learned that if I page my files with less, I can press v and open the buffer in Emacs. This works as long as I have the environment variable $EDITOR set up correctly, which in my case I ...
12
votes
2answers
479 views
How to use `cat` or `less` depending on the line count?
When looking at the content of files, I'd like to automatically cat short files but less those that exceed the screen size. I could use something with wc -l, but is there a better way that maybe also ...
2
votes
1answer
171 views
Coloring line numbers in less?
Please consider the following example:
$ grep --color=always -n 'Format\|Files' /usr/share/doc-base/doc-base | less -R
Here, grep will color also the line numbers of the matches, and less will ...
24
votes
1answer
1k views
Is there any way to exit “less” without clearing the screen?
Relatively often, I find myself wanting to quit less but leave what I was viewing on the screen, to refer back to. Is there any way to do this? Workarounds?
(My current workaround is to quit, then ...
3
votes
1answer
140 views
Using more command
Is there any case or reason to use "more" unix command instead of "less". As far as I see "less" is "better" in all senses, so does it mean that "more" is a command which has no reason to be used when ...
6
votes
4answers
276 views
pager program like less, able to repeat top N lines
Is there any way to make less program repeat first line (or first 2 lines) on every displayed page?
Is there any other pager program which can do this?
This would be a killer-app for database table ...
4
votes
2answers
671 views
Follow a pipe using less?
Can less follow (by pressing F) a piped input (similarly to a file)?
For a file that is being written to, the command
less <file>
will follow the file when pressing F.
But if I have a ...
15
votes
5answers
982 views
Is there a way to make tail -F beep?
Is there a way to make tail -F or less beep (ring the bell in a terminal) when new data comes in (a new line is added to the file).
Or is there any other unix utility to do this on a linux or mac.
2
votes
1answer
238 views
What is the `less` command line option to page to the next file at the end of the current one?
I'm sure there used to be an option in less which allowed you to page onto the next file after you reached the end of the current file, so you could just keep *space*ing through a bunch of short files ...
3
votes
1answer
105 views
How can I force less to stop buffering its input line by line?
When reading from stdin, less does not display any output until a whole line has been read.
I use a script that prints progress on one line, without printing a newline, and I would really like to be ...
1
vote
1answer
50 views
How to make less show the previous lines when searching?
How can I make less show the previous couple of lines when I search for something? I'd like to get rid of the kkk steps in my usual process:
/keyword
kkk
(read)
n
kkk
(read)
4
votes
2answers
160 views
Why do 'man' pages have many extra lines?
When I run the command:
man fork
There is a highlight line at the bottom that reads:
Manual page fork(2) line 52/99 (END)
But when I navigate to line 53 and up to 99, these are just blank ...
3
votes
2answers
390 views
How to change default “reading” program?
right now when I run man smth or similar less is used to view it. However, on Mac OS X, I really like scrolling with touchpad instead on up/down or page-up/page-down buttons. Is there a way to just ...
1
vote
1answer
159 views
less -j is not working for me
less -jn where n is a line number to jump to is not working for me. It just has no effect. I'm running less version 436 on Ubuntu 11.04. I also tried less --jump-target=200 and LESS='-j200' less ...
2
votes
2answers
423 views
'less' width issues
I'm connecting to my Linux boxes (primarily Debian Squeeze) using Putty for Windows. Whenever I run a 'less' command, e.g. on an aptitude search, less truncates the listing to much less than my ...
8
votes
2answers
1k views
Can less invoke vim instead of the default vi when I hit the 'v' key?
I want to launch vim instead of the default vi editor when I hit v in less.
Are there any settings I can modify to allow me to do this?
5
votes
1answer
265 views
Unhighlight Last Search in 'less'
When you use a / forward search or a ? backward search in less, all instances of the file get highlighted. After I've found the instance of the word I'm looking for, what is the most correct way to ...
4
votes
2answers
1k views
Colored man pages not working on gentoo
I have a problem using these methods to get colors in my man pages in gentoo. I've asked already in the gentoo forums but it still doesn't work, and the comments in a bug report (Bug 184604) don't ...
5
votes
1answer
249 views
Force less to display a file as text
Sometimes less wrongly recognize file as binary and tries to show hexdump on LHS (usually ones with non-alphanumeric characters but still containing printable ASCII characters). How to force it to ...
2
votes
3answers
582 views
Which systems have 'pager' shortcut/alias?
On a Debian system, one can type pager in order to use whatever pager program happens to be default/available. By default, less is used, and if not available, the lesser more gets to do the job. Is ...
2
votes
1answer
218 views
Use _roff to underline words
I currently have a file that I'd like to pass through a _roff to format with underline a few words in the file, and then view the file in less. Just a few, mind you, not whole sections or anything.
...
