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
2answers
28 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.
1
vote
1answer
79 views

How to disable log feature of less command?

I use less command a lot to view files, but when viewing a file, sometimes accidently I typed s key within less then the log feature would be activated, and if I didn't notice that log in the bottom ...
6
votes
2answers
388 views

Can I use the mouse to properly select text in less?

I've just discovered that I can add the following lines to ~/.vimrc. set mouse=a :vmap <C-C> "+y This has the effect of being able to select text with the mouse (i.e. in visual mode), and ...
0
votes
2answers
50 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?
15
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, ...
8
votes
1answer
71 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 ...
4
votes
1answer
35 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 ...
10
votes
2answers
577 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 ...
9
votes
3answers
664 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 ...
2
votes
0answers
18 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 ...
6
votes
3answers
857 views

Piping into less and editing: “cannot edit standard input” error. Workarounds?

I recently learned that if I page my files with less, I can press v and open the buffer in Emacs. This works as long as I have the environment variable $EDITOR set up correctly, which in my case I ...
0
votes
4answers
75 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 ...
1
vote
1answer
32 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
1answer
20 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.
4
votes
2answers
82 views

Can 'less -F' be usefully combined with termcap initialization?

less -F closes less if the contents fit on one screen. However, if I use termcap initialization, i.e., I don't use -X and the file fits on the screen, nothing is printed because less displays the ...
4
votes
2answers
369 views

less --quit-if-one-screen without --no-init

I'm on a terminal that supports the alternate screen which is used by less, vim, etc. to restore the previous display after exiting. That's a nice feature, but it really breaks the ...
6
votes
4answers
652 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 ...
0
votes
1answer
34 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
45 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
31 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 ...
5
votes
1answer
3k views

Is GREP_OPTIONS= --color=always ignored?

I was playing around with setting GREP_OPTIONS and couldn't get it to work. Just curious as to why. Simple test commands output: richard@ubuntu:~$ echo $GREP_OPTIONS richard@ubuntu:~$ ...
2
votes
1answer
564 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
1answer
59 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
29 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
44 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 ...
5
votes
3answers
335 views

How do I less a filename rather than an inode number?

I have a piece of software that rotates its log files when it restarts. However, during development, I am restarting it a lot, so I would like to monitor the latest log file at any time. If I start ...
3
votes
1answer
122 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
36 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/ ├── ...
1
vote
2answers
52 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 ...
0
votes
1answer
36 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 ...
6
votes
1answer
121 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 ...
2
votes
2answers
67 views

Live replacement, while viewing log using LESS

It's very convenient to monitor logs using less command - you see what is going with your system as it happening. The bad thing is that my logs are optimized for grep tool: each atomic action is ...
6
votes
3answers
563 views

How do I write all lines from less to a file?

I've piped a command to less, and now I want to save the command's output to a file. How do I do that? In this case, I don't want to use tee, I want a solution directly from less, so that I don't ...
8
votes
3answers
195 views

Can I force `man` to do lower case sensitive matching?

When I search man pages, the search is case sensitive, but only with regard to upper case letters. E.g., x will match x and X whereas X only matches x. This is the man-db version of man, used on ...
2
votes
1answer
39 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 ...
1
vote
1answer
76 views

A terminal that is always scrollable or forever like less?

I'm currently using #!Waldorf, but have used Manjaro, Mint, Ubunto, Fedora, etc. Is there a way to make my terminal always behave like it's passed to less but without the (END) "feature" that ...
5
votes
2answers
1k 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
3answers
37 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 ...
3
votes
2answers
75 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 ...
0
votes
1answer
31 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 ...
31
votes
3answers
6k views

Colors in Man Pages

When I look at a man page in my 'console' (not an xterm) I see some coloration, but I don't get this in my xterm's (e.g. konsole) is there any way I can enable this? hopefully a fairly simple ...
1
vote
1answer
35 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 ...
92
votes
4answers
23k views

Can less retain colored output?

Can I get less not to monochrome its output? E.g., the output from git diff is colored, but git diff | less is not.
15
votes
2answers
1k 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?
6
votes
4answers
197 views

Horizontal scrolling in smaller increments with less -S

I'm using less to parse HTTP access logs. I want to view everything neatly on single lines, so I'm using -S. The problem I have is that the first third of my terminal window is taken up with metadata ...
12
votes
3answers
601 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
182 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 ...
11
votes
4answers
3k views

Follow a pipe using less?

Can less follow (by pressing F) a piped input (similarly to a file)? For a file that is being written to, the command less <file> will follow the file when pressing F. But if I have a ...
2
votes
2answers
123 views

Exit from less by pressing ESC key

Can I setup less program to exit from it by pressing ESC key?
4
votes
1answer
186 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 ...