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

6
votes
1answer
219 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
30 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
0answers
28 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
44 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
46 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
13 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
28 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
159 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
40 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
38 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 ...
1
vote
1answer
58 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
21 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
15 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 ...
1
vote
2answers
19 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 ...
1
vote
3answers
41 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
21 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
42 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
146 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 ...
2
votes
1answer
61 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
40 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
36 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
224 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
111 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
67 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 ...
0
votes
1answer
72 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 ...
2
votes
0answers
25 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
229 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
104 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
68 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 ...
2
votes
0answers
75 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 ...
2
votes
2answers
216 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
46 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
39 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
148 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
80 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
120 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
227 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
844 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
76 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
425 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 ...
0
votes
1answer
92 views

regain regular expression search pattern while using less command

I need to regain regular expression search pattern while using less command. Is there any way to do that?. Once I start searching the expression disappears.
0
votes
1answer
94 views

page up and page down alternative for horizontal scrolling in less

In vertical scrolling using less the page up and page down keys are working. Which keys scrolls one page down/up vertically? The less was started with -S option.
8
votes
1answer
151 views

How to prevent HP-UX command “less” from messing up my prompt?

I don't like the output of more on HP-UX, so I use less instead as a pager: PAGER=less Its output is nice, but, on Linux, when I use man and then quit, I go back to the shell, and the display looks ...
0
votes
1answer
71 views

pager “less”: --quit-if-one-screen without --no-init [duplicate]

I can't get less --quit-if-one-screen (-F) working without --no-init (-X). less --quit-if-one-screen /proc/uptime I see no output. This works: less --quit-if-one-screen --no-init /proc/uptime ...
-2
votes
1answer
179 views

Go to line in less command is not working if using “+Gg” at the same time

I want to go to line 100 directly when opening a file, but I use -M and +Gg at the same time to show verbose detail in status bar. -M is for the file name and line number of the current screen +Gg ...
3
votes
1answer
40 views

Unwanted ctrl+h in file saved from man's output

After man less (and optionally hit h for "Summary of less commands"), since man uses less to display the text, I hit s to save the text to a file. When I open the file in emacs or vi, there are ...