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

0
votes
1answer
20 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
30 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
122 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
24 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
37 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 ...
0
votes
0answers
8 views

bash one-liner for opening `less` on the last screen w/o temporary files [migrated]

I try to create o one-liner for opening less on the last screen of an multi-screen output coming from standard input. The reason for this is that I am working on a program that produces a long AST and ...
3
votes
1answer
28 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
25 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.
6
votes
2answers
171 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 ...
4
votes
1answer
78 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
48 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 ...
1
vote
1answer
41 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
17 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
121 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
51 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
54 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
63 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
175 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
38 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
136 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
74 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?
17
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
88 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
206 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
752 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
69 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
335 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
78 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
77 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
122 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
53 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
135 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
39 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 ...
3
votes
1answer
129 views

Is there any way to exit “less” follow mode without ^C?

Often times I find myself in need to have the output in a buffer with all the features (scrolling, searching, shortcuts, ...) and I have grown accustomed to less. However, most of the commands I use ...
6
votes
1answer
677 views

Does less have a feature like tail --follow=name (-F)

The command less can be used to replace tail in tail -f file to provide features like handling binary output and navigating the scrollback: less +F file The + prefix means "pretend I type that ...
0
votes
2answers
43 views

is it possible to open files in subdirectories with less?

I sometimes use less to quickly page through a small collection of files using something like less brscan/*/* and then I use :n to cycle through the files If I have a folder/s e.g. brscan/ ├── ...
0
votes
1answer
427 views

Interactive less search with wildcards [duplicate]

I'm using less to view a large file and I want to search for a pattern with wildcards — e.g., " x 1??" where ? is any character. Does less support that, and if so how would I do that ...
7
votes
1answer
530 views

Is `tail -f` more efficient than `less +F`?

This article pointed out some reasons to use less +F over tail -f. Most of the reasons are about the features, not technical reasons: less +F can highlight, search, navigate through file. How about ...
1
vote
2answers
128 views

How to run a long running grep, pipe the result into less and put everything into background?

I often find myself in the situation where I need to find a code base for a given symbol like so: find src/galio -not -path './src/stapi-sdk/apilib/* -regextype posix-extended -iregex ...
2
votes
1answer
115 views

How to chain multiple LESSOPEN scripts?

Linux distributions nowadays have a default LESSOPEN set to /usr/bin/lesspipe which allows one to easily inspect e.g. zipped files or PDF files. Now I wanted to see whether I can add syntax ...
4
votes
2answers
278 views

less: /pattern search starts at first line

Consider the following file: $ LESS= \less test abc def abc By default, searching /abc in less will jump to line 3 since /pattern search starts at second line according to man 1 less: /pattern ...
1
vote
3answers
45 views

xargs git: skip user input

I have an xargs function that calls git commands recursively. When I now call gitr log I have to hit enter until the end or q to get the next xargs call to run. Can I tell xargs to skip user input ...
0
votes
1answer
44 views

how to stop at a specific point in a list

I created a shell script called blossom() because my girlfriend's dog Blossom poops and pees on the floor all the time. blossom() { echo poops and pees on floor all the time } Because I am such ...
1
vote
1answer
53 views

Can less be instructed to collapse blocks of lines

Is there a way to instruct less to fold blocks of lines matching some criteria into a single line in the view? For example while viewing a mail spool with less, the mail headers may take up a lot of ...
13
votes
3answers
1k views

No colored output in less for the ls command

If I run ls I get colored output which I find pretty handy for quickly getting a glance of the kind of file. When I try to pipe it to less even with the -r and -R flags the coloring always get lost. I ...
4
votes
4answers
520 views

Viewing man pages with scroll wheel support

I'd like to use the scroll wheel (xterm mouse escape codes) to scroll through man pages, like I can in emacs with xterm-mouse-mode. less doesn't seem to have support for that and short of recompiling ...
2
votes
2answers
322 views

Exit from less by pressing ESC key

Can I setup less program to exit from it by pressing ESC key?
0
votes
2answers
120 views

Find out which encoding method less uses to display the content of a text file?

There is a plain text file, which Emacs can't display correctly, but less can. I wonder if less automatically detects the encoding method for each individual text file, or just use a single default ...