less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time.

learn more… | top users | synonyms

6
votes
2answers
606 views

on quit, 'less' does NOT clear its contents when run in a 'screen' session [duplicate]

Possible Duplicate: Using screen, commands like less and man don't clear the screen afterwards When I quit 'less' in a normal bash, it clears the previous contents displayed by 'less' and ...
10
votes
1answer
3k views

How do I include newlines in a search in less?

How can I search for newlines (or end of lines) as part of a search using less? For example, I'd like to search for length=9\n, but don't want to merely search for length==9 because that'd get ...
5
votes
3answers
468 views

Let less work like cat, if only one screen full of text

On my Debian machine here, less always opens the alternate screen to show stuff. This is annoying, if there are only 2 or 3 lines to be displayed. I'd like less to: work as pager, if there is more ...
11
votes
2answers
2k views

In Unix “less”, can I jump to the next line that does NOT contain X?

In the Unix less tool, is it possible to jump to the next line that does not contain a certain expression? I sometimes have to look through files that contain thousands of similar adjacent lines ...
1
vote
2answers
1k views

pipe a program into less

I'm taking the dive into setting up and learning git and at the same time learning bash. I'm trying to do something simple as view the help section of $ git config unfortunately, when I type that ...
2
votes
1answer
624 views

less tail mode + pipes?

Why doesn't less's tail/scroll mode work with pipes? For example, I'd like to make a build script pipe to less in order to make the output of the build script scrollable. So... make | less +F ......
7
votes
1answer
415 views

Getting LESS to return back to command line if a short file is displayed

Is there a command line option that will allow less to return to the command line if there are not sufficient lines in the file to warrant paging. Sure I have seen it in the past but can't find the ...
5
votes
3answers
2k views

Change less (pager) default options

I'm using Ubuntu 10.04. My default pager(set using update-alternatives, not $PAGER) is less. The problem is, when I use ri(Ruby documentation tool) with the '-f ansi' mode, less shows the escape ...
5
votes
5answers
7k views

How do you run `less` and have it run a search pattern automatically?

I'm trying to run less in Linux, and I want it to search for something immediately after launch. It's basically like doing this: $ less Then press '/', type a search pattern like "^commit \w+$", ...
1
vote
8answers
346 views

How can I get file information in 'less' like with 'man'?

When I view a file in Linux with the 'less' command, I often only get a ":" prompt in the bottom left corner. There's no clue about how long the file will be, or at which location I am currently. When ...
2
votes
3answers
3k views

Use `less` pager on file with non-standard encoding

I often use the less pager to view logfiles. Usually I use less -F to follow the progress of the log à la tail. However, some logfiles use national characters in a non-standard encoding (Latin-1, ...
1
vote
1answer
289 views

less -Sr colourful.log How to view colourful log in less?

Both less -r (preserve terminal control sequences) and less -S (chop long lines) work well alone. But using them together breaks things. It chops too late and it wrecks the next line. Reducing ...
2
votes
2answers
1k views

unix less - problem with Enter key on numeric keypad

When I use the unix command 'less' I am constantly frustrated that using the Enter key on the numeric keypad doesn't work but instead types 'ESCOM'. Is there a way to fix that?
29
votes
7answers
6k views

Mercurial. Colour output piped to less

Operating system: Mac OS 10.6.2 I'd like to be able to see colour output when piping certain commands through less. Two examples: I've got ls aliased to ls --color=auto, so I'd like to be able to ...
197
votes
10answers
89k views

Get colors in less or more

When I read a file in Linux with the command less or more, how can I get the content in colors?
0
votes
2answers
301 views

Getting less to stop highlighting non-ascii characters

I have some logs which I want to read in less. Unfortunately, scattered throughout the otherwise text file are some non-ascii characters that less displays as highlighted junk. This is really ...
5
votes
3answers
705 views

Incremental searching with the `less` utility

Does less have an incremental search? I'm on xubuntu.
3
votes
1answer
464 views

Tailing multiple files with less

I want to have the best of both worlds with tail and less. Following multiple files, like tail can, but also having the scrollable buffer of less. So, I tried: tail -f mylog1 mylog2 | less +F But ...
61
votes
1answer
38k views

Less: Quickly Jump to Line Number in Large File

I'm struggling to figure out a way to do this...I'm using less to view a large (~1GB) file. I want to jump to line "$n" in the file - preferably without having to wait for lines 1-($n-1) to scroll by ...
4
votes
4answers
702 views

Unix command to empty logfile from within “less”?

I prefer using "less" to reading logfiles. As opposed to "tail -f" I can both follow (Shift + F), stop (Ctrl + C), and navigate up and down u and d, etc. Now what I really would like is the ability ...
11
votes
2answers
5k views

Mouse wheel scrolling in less and vim using urxvt

I have started working with rxvt-unicode (aka urxvt) but found an issue with mouse-wheel scrolling, as compared to gnome-terminal and konsole. The mouse wheel works fine for going through the ...
89
votes
12answers
32k views

How to syntax highlight via Less

is there a way to syntax highlight a file I see in Less? actually I'm using this command to open an xml file (and sometimes a series of them) less htmleditors/htmleditors_config.xml or less [...
136
votes
3answers
38k views

less command with multiple files: How to navigate to next/previous

I just found out I can use less with multiple files. less status line tells me (END) - Next: file2.txt But how do I navigate previous/next from less?
11
votes
3answers
3k views

Why does less tail mode stop working?

Using the less command on linux in tail mode (F command or less -f) consistently stops working on certain machines and/or certain files. New changes simply stop showing up. I know I've fixed this ...
150
votes
4answers
35k views

Less and Grep: Getting colored results when using a pipe from grep to less

I use the --colour option of grep a lot, but I often use less as well. How can I pipe grep results to less and still preserve the coloring. (Or is that possible?) grep "search-string" -R * --colour | ...