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

3
votes
3answers
41 views

Why can't ed be exited with C-c?

The program ed, a minimal text editor, cannot be exited by sending it an interrupt through using Ctrl-C, instead printing the error message "?" to the console. Why doesn't ed just exit when it ...
2
votes
1answer
10 views

When using less with -S option, it moves text on top when I press right key

I am using less as pager in MySQL, and I have configured it with -S flag, so that it does not wrap text. The only issue is that, when I have a small result set and want to see what is on the right, I ...
5
votes
4answers
358 views

How do I prevent less from clearing the screen on exit? [duplicate]

I often pipe commands to less in order to read through the output (e.g. compiler errors). MyCommand | less This is great because it makes trawling through large amounts of output easy, but when I ...
0
votes
1answer
29 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?
3
votes
1answer
27 views

Can I make “less” execute arbitrary commands with a single key sequence?

The crux of my question is stated in the title. Reading the less and lesskeys manpages, I have created a file containing: ^B shell touch ~/testfile and run it through lesskey to generate ...
8
votes
0answers
269 views

scroll through output using `less` or `tail -f` while keeping the header visible [duplicate]

I am trying to scroll through some data formatted thus- NFI T[PSEC] T[K] EKIN(PSI) E(RHO) ECONS ANNEE ANNER !> 1 0.00012 0 0.45873 16.26904 16.72777 ...
13
votes
2answers
289 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?
0
votes
1answer
49 views

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

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 ...
5
votes
2answers
77 views

“command | less” vs “less <(command)”

A common "idiom" for viewing large amounts of command output is to pipe it to less, via command | less. However, it's also possible (perhaps only in bash, haven't tested in other shells) to use the ...
2
votes
0answers
35 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 ...
1
vote
2answers
28 views

How do you make less show the filename?

I often have multiple terminal windows opened with less (eg comparing various log files). I forget which file is which. Is there a similar command to ^G in vi which displays the name of the file ...
1
vote
1answer
24 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. ^C ...
1
vote
2answers
175 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 ...
7
votes
3answers
94 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 ...
0
votes
0answers
27 views

Why does SPACE sometimes not work with more (or less)

Usually with |more I press space to get another screenful. But with some commands space just does nothing, and I need to actually keep doing SPACE-ENTER to scroll forward a screen at a time. Both more ...
6
votes
2answers
184 views

less '+>' /path/to/file

So Gilles mentioned in the chat room that: less '+>' /path/to/file can be used with less in order to view a file in reverse. I've never seen it before. I'm curious - what's going on with the ...
4
votes
1answer
220 views

How can I get less or cat to use color in the output from .cat of my .bashrc, similar to vi 'ing it?

When I vi my .bashrc file it is colorized, i.e. but when I cat or less the file I get all white, i.e. How can I get cat (and less) to have color? cat does have color for my ruby .rb files but ...
5
votes
2answers
282 views

show colors and disable line wrap

Using the less paginator, you can use the -r option to properly display colored input and the -S option to disable line wrap. However, when using less -rS or equivalently less -r -S, colors are ...
2
votes
1answer
283 views

less is always case-insensitive

Trying to find out how to use case-insensitive searches in less I found this on serverfault. That seems to perfectly answer my question. The problem is: It doesn't work like that here (openSUSE 13.1; ...
0
votes
1answer
47 views

Piped search queries in vim or less

I would like to be able to search a log file for lines that being with ^2014-02-18 15:30:[0-9:,]* and have UserName:someguy much later in the same line. I am sure I could do a regex to include any ...
5
votes
2answers
170 views

Write lines to a file from less

While in vim I can write a range of lines from the file I'm viewing to another file. For example, :1,10 w outfile.txt will write lines 1 through 10 to outfile.txt. Can I do the same while I'm ...
1
vote
1answer
102 views

Cat and Less give different output

I executed the following command # top > /home/user/top_output.txt Nothing Happened for a while and then i pressed Ctrl+C. When i checked the file that was created, it had the contents in it. So ...
3
votes
1answer
25 views

Have man pages display how far I am through the file

With less, the -m flag extends the prompt to include a percentage. But how do I get man to do the same thing?
2
votes
1answer
63 views

less command runs out of memory

When searching for string (no regex etc.) in large file less filename and less -b 1 filename quits or prints it cannot allocate memory. top shows less using roughly about 5% of memory before it dies ...
3
votes
1answer
64 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 ...
4
votes
2answers
42 views

Can less load lines which were appended to a file after opening?

When I am viewing a log file in less is it possible to make less reload the file to get lines which were appended to that file since it was opened?
2
votes
4answers
281 views

How to copy multi-page text from the terminal into the clipboard?

I was viewing a man page for a software on my machine and I needed to copy-paste some of that text but the text was much more than one page. I'm aware I can direct the output to a file and use UI ...
6
votes
1answer
333 views

Documentation on LESS_TERMCAP_* variables?

I see these pretty colors in manpages viewed with less when setting a bunch of these variables. What do they mean, where is the documentation? Is this interpreted by less or termcap? screenshot
2
votes
2answers
92 views

can I get the shell to decide ls or less depending on filetype?

Very often I find myself looking through directories using 'ls', then when I find the file I want, I use 'less' to look at the file. So for example to find a mysql log file I might type ls /var ...
2
votes
1answer
122 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 ...
-2
votes
3answers
84 views

How to get an specific amount of lines in the console with less? [closed]

Can I get the specified number lines at a time by using the less command? I want just ex. show 20 lines even if my screen allows more.
3
votes
2answers
70 views

less freezes at last line when paging output from a running command

I have a CLI app that produces lots of debug output and I have a really big need to search in the output. I'm using less for that but it freezes when I reach the last line with j or G. And it returns ...
0
votes
2answers
366 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
1answer
36 views

Why does combining `less` and `script` disrupt line endings?

This bash snippet will print out the numbers 1 to 10: $ for i in $(seq 1 10); do echo $i; done 1 2 3 4 5 6 7 8 9 10 When I try to use this with script and less like so: $ script -q -c 'for i in ...
3
votes
1answer
263 views

less follow mode - clear screen

I use less follow mode (Shift-F) to follow a log as it is updated. Sometimes it would be useful to do some actions on my system, and then only see log output related to that action. Basically I would ...
2
votes
2answers
550 views

Case insensitive search in man pages

Is there a way to search man pages case-insensitively? Using the '/' search feature matches exact case.
1
vote
1answer
63 views

how to make less -S not take up the entire screen

suppose I have this: cat new_file.txt | less -FRSX Then suppose I press the right button in order to scroll to the right This will cause the contents of new_file.txt to move to the top of the ...
7
votes
3answers
352 views

How does less know the terminal resolution?

Everytime someone set a different size for a virtual console, less recognize window-resolution (I'm assuming that ...); according to that it changes how many lines of text it should visualize. How ...
2
votes
4answers
1k views

less command and syntax highlighting

I need to use the less command with the syntax highlighting of the vim command for python, C, bash and other languages. How do I apply syntax highlighting colors according to vim colors for less ...
6
votes
2answers
178 views

How can I pipe colored tree result to less or more?

I get colored tree using tree -C but when I pipe it to less I get results like this: tree public/ -C | less How can I have colors in less in this case?
4
votes
2answers
119 views

Shift-Space in less

In modern web browsers and other software with text content, Space scrolls down more or less a screenful. ShiftSpace scrolls up in everything but less. How can one use ShiftSpace to scroll up in ...
3
votes
2answers
115 views

Viewing very wide files

I need to view some 5,200 byte wide files. Is there any tool to make this practical without modifying the file? Ideally, I'd like to specify which columns I'm viewing.
5
votes
2answers
180 views

Can I get vim-stlye (hjkl) navigation for GNU info?

The layout of my netbook's keyboard means that using the arrow keys for navigation is slightly uncomfortable. Is there a way to make GNU Info pages use vim-style hjkl navigation? I know I can info ...
0
votes
1answer
84 views

less or more - which to use when? [duplicate]

less and more seem to have very similar functionality in that they both page through text a screen at a time. What reasons are there to use one over the other?
15
votes
1answer
4k 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 ...
3
votes
1answer
111 views

How to follow and seek in a file being piped through a filter, in less

I basically wish to seek, search and follow a growing log file after passing it through a sed filter. I figured I need to follow a file with tail -f pipe it to sed and then pipe that to less. For ...
3
votes
2answers
515 views

Get 'less' to display filename

Something that seemed quite useful to me when looking for a certain var in a bunch of config files: less * | grep some_var So this returns the value of some_var without manually looking through all ...
3
votes
3answers
3k views

Characters encodings supported by more, cat and less

I have a text file encoded as following according to file: ISO-8859 text, with CRLF line terminators This file contains French's text with accents. My shell is able to display accent and emacs ...
0
votes
1answer
136 views

Man displaying groff control characters

Man is displaying groff control characters after I compiled a later version of groff. For example, when I try to view groff's man page: GROFF(1) General Commands Manual ...
2
votes
2answers
1k views

How do I pipe colored diff output to less?

I've been using git diff, which produces colored output. However, I now find I need to use ordinary diff for something, and it's producing a lot of output that is hard to read because of the lack of ...