less is a terminal pager program used to view (but not change) the contents of a text file one screen at a time.

learn more… | top users | synonyms

9
votes
1answer
871 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 ...
12
votes
2answers
855 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
250 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 ...
27
votes
1answer
2k 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
179 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
419 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
1k 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 ...
17
votes
5answers
1k 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.
16
votes
4answers
1k 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.
4
votes
3answers
532 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 ...
3
votes
1answer
135 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
63 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)
23
votes
14answers
3k 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? ...
37
votes
3answers
11k 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.
4
votes
2answers
168 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 ...
2
votes
1answer
382 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
2answers
570 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 ...
2
votes
1answer
210 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 ...
9
votes
2answers
2k 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?
2
votes
2answers
541 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 ...
5
votes
1answer
408 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 ...
6
votes
1answer
833 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 ...
8
votes
2answers
2k 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
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 ...
2
votes
3answers
772 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 ...
28
votes
7answers
20k 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
239 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. ...
13
votes
7answers
3k 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 ...
17
votes
1answer
2k 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 need ...
20
votes
3answers
3k 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 ...