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
2answers
25 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 ...
1
vote
2answers
39 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 \...
11
votes
2answers
849 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
159 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 ...
1
vote
0answers
29 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
259 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 ...
2
votes
1answer
35 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 ...
0
votes
1answer
44 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 ./...
2
votes
0answers
49 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
105 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 ...
0
votes
1answer
18 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 ...
1
vote
1answer
70 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 ...
4
votes
5answers
189 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
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 |...
4
votes
2answers
43 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....
1
vote
1answer
71 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 ...
3
votes
1answer
22 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? ...
1
vote
0answers
17 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. ...
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-...
1
vote
2answers
23 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
51 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?
0
votes
1answer
22 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
56 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 ...
4
votes
1answer
173 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
91 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
48 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
41 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 ...
2
votes
1answer
30 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.
5
votes
2answers
277 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 ...
3
votes
1answer
141 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 ...
2
votes
1answer
84 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^...
0
votes
1answer
92 views

Busybox pager with color capability?

I asked on Superuser about colors for git log in MobaXterm (on Windows), but it turned out that the problem wasn't MobaXterm—it's the lack of a -R flag in busybox's less. It would help my workflow ...
1
vote
0answers
27 views

Various environments and weird less behaviour [closed]

I am playing with I/O redirection and have problem with less behaving differently in two environments. Both environments are Solaris-based and are of the same version. I am executing program in two ...
2
votes
3answers
289 views

less with multiple files; command to output filenames

I want to be able to manually go through many files using less *.txt and then proceeding through the files using :n. If I determine that a file needs to be processed, then I want to be able to give a ...
3
votes
1answer
136 views

less: Go to end of as much of the buffer as is loaded, not the actual end of the buffer

I'll often use less to page through the output of a program that's going to keep producing output, such as with tail -f /var/log/messages | less. Is it possible to jump to the bottom of the current ...
3
votes
1answer
75 views

Is there a way for “less” to truncate lines and still exit after < 1 screen?

Like many (most), I use git, which by default sends its output (for diffs, logs, etc.) to less, with the options -FRSX. The options are overrideable in .gitconfig by setting the pager to be called ...
3
votes
0answers
81 views

Why does “less” sometimes forget its history

I set and exported $LESSHISTFILE and $LESSHISTSIZE but if I perform a search in one less session, close, reopen it and try to repeat my last search I get "No previous regular expression (press RETURN)...
2
votes
2answers
248 views

Redirect output of less utility to a file

Here is what I did less -N file1 > file2 what I want is writting file1 into file2 with line-numbers option. But I failed with that. Any suggestion to do that? Why I failed to do it? Thanks.
2
votes
1answer
48 views

How do I match the beginning of a line in a manpage?

When I do man zshbuiltins I typically want to search for a command. Suppose I'm looking for info on the alias command. I get a chunk of text like: : [ arg ... ] This command does ...
0
votes
2answers
41 views

How to open compressed file in less mode [duplicate]

How do I open a compressed file in less mode. I am able to grep using zgrep and using zcatI can open, but the file is big I want to open in less mode.
2
votes
1answer
155 views

How to disable log feature of less command?

I use the less command a lot to view files, but when viewing a file, sometimes accidentally I type the s key within less, activating then the log feature. If I don't notice that log in the bottom of ...
0
votes
2answers
83 views

How do you search ! in man sed?

You cannot search ! directly because it puts process behind. For instance, you cannot search ! in sed man. How can you search ! in man?
18
votes
3answers
2k views

How to “less” a file named “-”?

I accidentally created a file with the name - (eg, seq 10 > -). Then I tried to use less to view it, but it just hangs. I understand that this is happening because less - expects input from stdin, ...
4
votes
1answer
134 views

Gedit displays text, but cat tells a different story

I am trying to sort a dictionary from Grady Ward's Moby and have encountered a bit of a problem. When I open it in gedit, I get: abaca×N abaciscus×N abacist×N aback×v abacli×p Abaco×N abactinal×A ...
9
votes
1answer
250 views

OS X, bash: less works on open file descriptors, cat doesn't

In a bash script I'm working on (which has to run on Ubuntu and OS X), I need to redirect the output of hundreds of commands to a file. Rather than appending &>... to all of them, I simply do ...
10
votes
2answers
880 views

Open a .raw file as text in less

The output of my program has a .raw file extension. If I try to open this with less I get: No isoinfo available Install mkisofs to view ISO images The file isn't an image file, it's just text. Is ...
2
votes
0answers
21 views

Pager that would work with header-lines? [duplicate]

Is there any pager, like less, that would allow paging result, but keeping configurable number of lines at the top always? Example: I run a query that returns many rows from database. Results are ...
1
vote
1answer
86 views

man page search - how can I turn off the highlighting after matches found?

When using man pages, a commonly used feature is to use / then a search term to get to a word of interest. Once found, all matches remain highlighted - this can often be distracting when I just want ...
0
votes
4answers
520 views

“emacs: standard input is not a tty”

I followed http://unix.stackexchange.com/a/43460/674: after $ locate -i linux | less I type g|$emacs - in less, but nothing is opened in Emacs, and the terminals says: emacs: standard input is not ...