Questions tagged [less]

less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time.

less is a terminal pager program on Unix, Windows, and Unix-like systems used to view (but not change) the contents of a text file one screen at a time.

185 questions
110
votes
1 answer

Less: Quickly Jump to Line Number in Large File

I'm struggling to figure out a way to do this...I'm using less to view a large (~1GB) file. I want to jump to line "$n" in the file - preferably without having to wait for lines 1-($n-1) to scroll by in my terminal. I would do this in vim using…
AJ.
  • 4,031
36
votes
1 answer

How to center search results in Less, instead of moving matched line to top of terminal

When searching for terms in less, I'd like to see lines above and below a search result. Can less be configured to do this? Simple less usage is: - Open file - Search by typing "/" - Move to new search matches with "n" But each match is shown on the…
11
votes
2 answers

less doesn't highlight search

Something happened so I don't see less highlights any more. I've tried: using different terminal. using -g option making sure -G isn't there ^K while searching ESC-U Nothing helps. I work in Ubuntu 12.10 on an i3 desktop. $TERM=screen-256. When…
11
votes
2 answers

`less` "search backward" command line switch?

I know less +/pattern filename will open the file and navigate to the first occurrence of the pattern. Is there a way to tell less to search from the end backwards? Does it even accept more than one + switch? Do not work: less +?pattern…
ultracrepidarian
  • 269
  • 1
  • 2
  • 9
3
votes
1 answer

less: continue search from top

Is there an automatic way (through command line params for example) of keep searching from start of text when the end is reached? (same as Notepad++ - Continue Search from top but with less linux command instead of Notepad++)
3
votes
1 answer

How can I stop `less` from removing ANSI color sequences from stdin?

tree go | less -R Debian/Linux tree includes ANSI color escape sequences matching the form ESC]...m in its output. I would like less -R --RAW-CONTROL-CHARS to output the incoming ANSI "color" sequences. I am wanting to see color in the output of…
Paul
  • 103
3
votes
1 answer

How to map function keys in less?

Is it possible to map function keys (F1-F12) in less with lesskey? This doesn't seem to work: #command F1 forw-line
Cyker
  • 381
  • 6
  • 19
2
votes
1 answer

Print content and exit if the content can fit in one screen in less command

I have the following in my ~/.gitconfig: [core] pager = less -+$LESS -MR This makes less to be used for git commands. git commands output contents in less irrespective of the size of the content. After I hit q, the whole content disappears, and I…
3N4N
  • 128
1
vote
0 answers

Is it possible to have less +F with lesskey's that work without interrupt?

My situation is that I currently have some lesskeys set. And they do things fine in normal mode, but I want to have the file that I'm view also be updated. This is obviously possible with less +F, except for the fact that it "breaks" the…
question
  • 111
1
vote
1 answer

why is `less` command using too `much` ram

I was using less to examine a rather large file (8GB on a machine with 4GB RAM). I told it to "scroll to the end" (shift+G) and it ran for quite awhile then was killed for using up RAM. I thought less wouldn't use more than a limited amount of RAM…
rogerdpack
  • 2,226
1
vote
0 answers

lesspipe.sh doesn't save tabstop setting

I like to use 4 spaces for tabstop, so my less settings is: export LESS="-x4 -FRS" export LESSOPEN='|lesspipe.sh %s' But when I view source file with less src.c I see 8 spaces which is not what I want. When I view file without lesspipe.sh like this…
LennyB
  • 111
0
votes
1 answer

Less not scrolling immediately on long lines (xterm-256color vs vt100)

When I press 'j' in a text file with long lines, it won't proceed to the next line until I've pressed j 'n' times. So if I have a file: a b c d e (long line that displays as 5 lines on screen) And I only see a-d, when I press j, I have to press j…
Nathan
  • 1
0
votes
0 answers

In less, what's the matter with the key as command?

In less I have been using the End key as a command for many years. This is in order to let less end working page by page but instead to let less make its work up to the end of the file from that position on. Thus I can next morning see all the…
Anton Wessel
  • 161
  • 10
0
votes
0 answers

Does `less`'s text search NOT work with huge files?

Either this is a bug, or I'm not understanding something. But I use less -p value filename.txt to search for value in filename.text and when I do it for a file that only contains a couple of lines of text, it finds it promptly and then highlights…
0
votes
0 answers

less showing ^M instead of going to a new line

I have a log file where borg --progress adds many lines separated by ^M. Weirdly, less puts the ^M in the screen "as it is", instead of producing a new line. Is there a reason for that? How can I have less going to a new line when a ^M sequence is…
1
2