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

2
votes
0answers
148 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 ...
2
votes
0answers
100 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
171 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 ...
6
votes
2answers
205 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 ...
4
votes
1answer
1k 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?
3
votes
1answer
164 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 ...
7
votes
1answer
1k 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 ...
9
votes
1answer
931 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
968 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
260 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 ...
29
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
182 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
462 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 ...
6
votes
3answers
2k 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
6answers
2k 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.
17
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
602 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
147 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
71 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)
24
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? ...
52
votes
3answers
13k 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
172 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
415 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
630 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
221 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
581 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
2answers
484 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 ...
8
votes
3answers
1k 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 ...
9
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
837 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 ...
29
votes
7answers
23k 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
246 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. ...
14
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
3k 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 ...