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

4
votes
2answers
27 views

Constantly display status line in less

I know I can have less show me the status line with =. Is there a way to have it displayed constantly and updated as I scroll through the file? When I use man it's actually done this way but I don't ...
4
votes
3answers
39 views

Ensure less clears screen

Is there a way to ensure less clears screen on exit? The opposite of less -X. The screen is not being cleared when I exit a man page in iTerm2, however the screen is cleared when using the default ...
4
votes
2answers
149 views

Customizing less colors

When using less in OS X, how can I customize the colors with with things are displayed? When I run less within an ansi-term in Emacs the colors don't come out nicely. $ less --version less 418 ...
2
votes
2answers
374 views

Less command change color of “~” and “(END)”?

How do I change the color of the "~" characters that go along the edge of a Less command output. And how to change the color "(END)" at the bottom?
8
votes
3answers
2k views

Make Less highlight search patterns instead of italicizing them

To my understanding man uses less as a pager, and when searching for keywords using less it "highlights" keywords with italics. I find that really inconvenient, so I'd like to change this to something ...
1
vote
2answers
51 views

What does [?1049h and [?1h ANSI escape sequences do?

When I used shell in a box and when I call less command (echo foo | less) in ajax response there was this code: \u001B[?1049h\u001B[?1h\u001B=\rfoo\r\n\u001B[7m(END)\u001B[27m\u001B[K what does \...
1
vote
1answer
21 views

How to install less on Oracle Linux Server

Oracle Linux Server contains more utility, because it is smaller than less utility. How can one install less in this RPM based distro?
68
votes
3answers
56k views

What are the differences between most, more and less?

I'm now using Arch Linux, and find a command most works like more and less. To understand the differences between them is a confusing problem. This Question has mentioned the differences between less ...
4
votes
2answers
25k views

How to exit file reading mode in linux terminal?

I appologize if its something really stupid i am asking. But this is my first day on linux commands infact I dotn have linux right now I have just installed CYGWIN for my learning. SO my question is ...
2
votes
2answers
29 views

less combined with sed color sequences prevents page breaks

If I use the command below which colors the lines output in yellow, it essentially turns less into cat, printing out the entire file and disabling all of the features I need with less, such as ...
8
votes
2answers
2k 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 ...
12
votes
2answers
865 views

What is less doing with rpm, and how do I get that text without rpm

When I execute less package.rpm, less shows me all sorts of meta info about the package. What is less exactly doing - does it have built in code to be able to extract meta info, or is an rpm ...
9
votes
1answer
168 views

Cause `less` to exit with a non-zero status code?

I would like to have the following command structure: command && check-status | less && followup-command This would pause the execution while the user interacted with less. How can ...
0
votes
1answer
48 views

How to Execute !gvim current line in Viewer?

Code find-xargs(less)-gvim %http://unix.stackexchange.com/a/277889/16920 find . -name "*.tex" -exec grep -il "agent" {} + | less -s -M +Gg Output ./InfectiousDiseases/1.4.2016.tex ./...
6
votes
1answer
3k 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?
2
votes
1answer
170 views

Exiting a '&pattern' search in less

After using a search in less of the format &pattern, which displays only matching lines, how can I go back to displaying all lines in the file? Esc doesn't do anything as far as I can tell. Ctrl+...
1
vote
0answers
30 views

Paging with follow less +F and colorize with awk

I would like to paginate a file with follow, i.e. $less +F and also colorize the output on the screen. I want to use less because I can leave the follow mode, browse the file and then re-enter the ...
2
votes
2answers
33 views

Ouput to a file and read it [duplicate]

I am trying to output the ps command to a file in /home/username/ps.txt. I want to create the file on the go, write the output of ps to it and also read the same in a single command. I tried this: ...
6
votes
1answer
273 views

How to use less in a script without getting ESC escape characters?

When I use less at the command line the output is like but when I use less from within a bash script I get: How can I use less in a bash script and not get all the escape characters and have it ...
4
votes
5answers
204 views

How can I search for bolded or underlined text?

How can I search for bolded or underlined text? This would often be useful to search for keywords, which are often highlighted as such. For example, in this excerpt from bash(1): I might want to ...
3
votes
1answer
41 views

How do I make less STOP chopping long lines by default?

The web seems to be full of resources for making less stop wrapping long lines by default and chop them instead. I have the opposite problem. It is chopping be default and I want to make it stop. I ...
6
votes
1answer
1k views

Piping the output of ls or tree to less loses colors?

tree and ls can distinct file types by coloring filenames differently. tree and ls often output a long list of files (including directories), so I pipe the stdout output to less. But less doesn't ...
2
votes
0answers
56 views

Prevent scp and less commands reading interactive tcsh script

I'm using tsch through PuTTY, and let's start by this: please don't try to convince me to migrate to another shell...:) It's being a long time that commands like scp and less didn't work well for me. ...
0
votes
1answer
26 views

Less quit behavior

I'm not sure how to describe this but I'll try by comparing it to vi. When I open vi, do something, and then exit vi it brings me back to the terminal where I can see all of the commands I had ...
0
votes
1answer
139 views

more less …skipping… when searching

When I search a file in less or more, it will remove lines and replace them with "skipping". Does anyone know what causes this and/or how to avoid it? After I '/' search a log file using either more ...
1
vote
1answer
98 views

`docker logs foo | less` isn't searchable or scrollable but `docker logs foo 2>&1 | less` is

Using either one gives readable text. But only with the stderr redirect can one scroll or type /somepattern and get matches. Without it searching gives "Nothing to search (press RETURN)" and a ...
69
votes
7answers
56k 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
42 views

Get contents of a file from first instance to last instance of some arbitrary string

How can I view in less from the first instance of some arbitrary string "foo" to the last instance? This arbitrary string will be on most every line of the log. I don't want to do grep "foo" bar.log |...
1
vote
1answer
90 views

What is the LESS environment variable to man and how is it set up?

What is the LESS environment variable used for in man? I found that it could make the output of man jump to a match to the pattern stored in LESS. What about when there are several matches? How is ...
4
votes
2answers
45 views

Terminate a text search in less(1) and continue to read thru a Unix pipe

gunzip < 100terabytes.txt.gz | less less(1) reads as many lines as necessary to fill your screen and then stops to read(2). As a result, gunzip(1) is blocked on write(2) as the pipe becomes full....
3
votes
1answer
24 views

Why does less store its configuration in a binary file?

I'm just wondering: why does less store its configuration in a binary file .less, which you have to generate with lesskey from the text-file .lesskey? What could be the benefits of this behavior? ...
11
votes
3answers
9k 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?
5
votes
1answer
30 views

Can I set both (in and out) charsets in `less`?

I can tell less to output characters in UTF-8: export LESSCHARSET=UTF-8 But then it tries to read files as UTF-8 as well. Can I tell it to read files as ISO-8859-2 (latin2) but display them as UTF-...
10
votes
5answers
1k 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 ...
7
votes
4answers
880 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 ...
1
vote
0answers
20 views

Search for occurrences of text in a long line in less

I am using less to view a file with many long lines. less automatically wraps these lines, but when I use / and n to search for something, it only shows the first occurrence of the text on a line. ...
10
votes
2answers
3k views

Negative lookbehind/ahead assertions in Linux less pager (or vim)

I want to find all instances of "index" not followed by .php in a log using less. /index(?!\.php) does not work. Is this possible? What is the regex for less and vim (do they differ?). Is this not ...
1
vote
2answers
27 views

How can I paginate a UTF-8 file and see the right characters?

If I use cat on a file containing UTF-8, it displays properly: % cat /tmp/sample <concept code="endangeredLanguage"> <description value="The language is endangered at the given date"@en/&...
1
vote
3answers
64 views

Does `less` or `more` support ansi escape `\x1b[2K` (erase_line)?

Basically I wanna animate my terminal but because the text is too long, I need a pager. Let's just say I wanna change my text colour periodically in less. Is it possible?
1
vote
1answer
25 views

man: hide help message

I have set high contrast color for "search results" in man: export LESS_TERMCAP_so=$(tput setaf 1; tput setab 3) so that my search results are highlighted and easy to find. Unfortunately, this ...
3
votes
1answer
63 views

Getting around *extremely* long lines in less

When navigating log files with less (e.g., using Space and B), sometimes I run into extremely long lines, as in 120,000 characters long long. It gets slow to navigate around these, I guess because it ...
22
votes
3answers
2k views

set tab width for less output

Is it possible for less output to set the tab width to a number X as it is for cat?
4
votes
1answer
191 views

Arrow keys in `less`

In the manpage of less the up- and down-arrow keys aren't mentioned in the context of normal navigation, yet on Debian Linux (8.2) they obviously work to scroll up and down. Why is this? A lesskey ...
3
votes
1answer
101 views

Search in less with wrap-around at EOF

Is it possible to enable "wrap around" in less for the search? This means: If the last occurrence of a pattern has been found, pressing n will start the search again at the beginning of the file (so ...
2
votes
1answer
50 views

How to configure `less` to print starting from the top of terminal window?

I recently switched from Ubuntu 15.04 to 15.10 and although they seem to have the same version of less, 458, I get different behavior. In my new system, if a file has fewer lines than the terminal ...
3
votes
1answer
42 views

Why do less search result lines disappear/reappear?

When skimming through a file with less, I'm able to see all lines just fine. When I do a search and then go for the next result with n, sometimes a highlighted result is shown on the top line, and ...
3
votes
1answer
153 views

What is the best way to pipe the output of a command through a pager if (and only if) it is too long?

I'd like to be able to be able to wrap a command so that if its output doesn't fit in a terminal it will be automatically piped through a pager. Right now I'm using the following shell function (in ...
5
votes
2answers
303 views

Where does less store history of search patterns?

Let's say I open a file with less and look for a pattern such as /time=32, then exit with q, and maybe run other commands. Then, if I open the same file again with less and hit n to repeat the last ...
2
votes
1answer
33 views

How to invoke less with a pattern

I'm trying to combine less +F with a &pattern, but can't get it to work like I want: less +F'&foo|bar' file.log It seems to ignore my pattern.
2
votes
1answer
91 views

How do I generate manpages using escape codes for bold, etc.?

While inspecting the source code of less, I noticed that the included manpage (less.man) used terminal escape codes for showing bold text: ^[[1mNAME^[[0m less - opposite of more ^[[1mSYNOPSIS^...