Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
13 views

less -+Option documentation

In this answer less -+S is used, to toggle the -S option off. I am wondering where this behaviour of less is documented, as scrolling less --help only yields +cmd Execute the less cmd ...
0
votes
0answers
14 views

Log watching in less

Let there be a log file, call it /var/log/example. As usual, a service continuously outputs lines to that file. I want to watch this file's contents in real time using less (or equivalent). I am ...
0
votes
0answers
11 views

Have pager (less) re-run git log upon keypress

Sometimes I find it handy to have the git commit graph (given by git log) displayed side-by-side to the terminal pane I'm working in. git log is run with the less pager by default and only shows the ...
11
votes
2answers
419 views

What does `LESS=+/EXAMPLE\:` mean?

In man parallel_tutorial (for GNU parallel) I’ve found the following black magic: LESS=+/EXAMPLE\: man parallel Searching around in the man pages for man, less, and bash, it appears this may have ...
0
votes
1answer
40 views

Graphical less alternative (log file viewer) [closed]

While I'm comfortable in the command line, I find a GUI easier to navigate and able to fit/scroll more information at a time. In the Windows world I'm used to TotalCommander, which has a really nice ...
0
votes
1answer
33 views

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 ...
0
votes
0answers
17 views

Less program rendering breaks

I've been experiencing this problem on multiple computers, over a long time, but I could never find any mention of it anywhere so I thought I should ask it to understand whether it's only me once and ...
0
votes
1answer
50 views

what's the least-painfull way to have less on Windows?

I want to use less, instead of more, on a Windows machine. I know I can install Cygwin and use its less. But I've also noticed there's GnuWin which offers a less, a stand-alone less, and there are ...
1
vote
1answer
62 views

Append to compressed log

There is a couple of z-utilities (zless, zcat), which are able to read contents of zipped file in transparent manner. Is it possible to append to compressed log file (in either format, not ...
1
vote
2answers
43 views

Less - How to jump to a part in a large pdf?

I am using less to view a large (Think over 5k page) pdf in my terminal. The pdf is divided up into chapters. I am curious to know, how do I go to a certain chapter in the pdf without knowing the line ...
0
votes
1answer
1k views

`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 + ...
1
vote
2answers
501 views

Pipe grep to less showing the grep command as file name

less -M will show the file name as a prompt, as in: 1 asdf test.txt lines 1-1/1 (END) I like to pipe grep into less for easier reading. Can I get less to interpret the grep command as file ...
0
votes
2answers
33 views

Telling `less` where to break pages

Is there some way to tell less where to break pages? I was hoping that ^L (form feed / page break) would do it, but found it doesn't. I tried the following: The first page. It is three lines long. ^...
0
votes
1answer
42 views

Special characters in less log file make it useless

I want to save the output of the Python help command to a file. Since it uses less, the obvious way is to "s file" while in less. It works, but the words which less shows in bold are screwed up. Any ...
2
votes
2answers
538 views

Command for reloading file from disk to show changes when using “less?”

In less is there a command for reloading a file from disk, so that less will show any changes made to a file since less was started? This would saving me have to terminate and restart less if I want ...
1
vote
1answer
26 views

less -z option: the manpage refers to it, but does not document it

Simply put, what does the -z flag to less do? In the prezto (zsh shell) config, the $LESS env var is set with flags and the last one is -z-4. What does this do? Is there a version of a less manpage ...
3
votes
1answer
1k views

regular expression search within command less

Exactly what kind of regular expression search is supported by less (e.g. can I use \d+)? man less isn't clear on that, and my primarily google on that didn't return much good hit either. Thx.
1
vote
1answer
70 views

Piped output wierdness with 'COMMAND | less', FreeBSD

I'm using FreeNAS 9.2.10 console, which is based on FreeBSD. I'm trying to pipe the output of commands through less as a pager: zfs list -v <poolname> | less. What I get is the tail of the file ...
2
votes
1answer
69 views

G in less doesn't go to the bottom

when I use G in less it's only scrolling down one screen length, rather than going to the bottom. vim on the otherhand will scroll to the bottom. Is there a reason for this behaviour?
4
votes
1answer
68 views

How do I close “less” from the outside without it leaving my terminal in a mess?

I'm writing a utility that automatically launches less as a subcommand with its output. Some times an error occurs while writing the output, and I would like to automatically close less and display ...
0
votes
3answers
88 views

Why does less +F say “can't open '+F'”?

I just read about the advantages of using less +F over tail -f and wanted to try it out. When I do I get the following: less +F /log/nginx_error.log less: can't open '+F': No such file or directory ...
0
votes
1answer
120 views

How to use `less` as default pager for `--help`?

I use --help option a lot. It's annoying how it jumps to the end with help. It can be done with |less option. I want |less to be my default option. Can I use less as default paging for --help? I use ...
2
votes
1answer
55 views

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
0
votes
2answers
696 views

how to search in all file using less

In less / search for the next pattern and ? search for the previous pattern. Is there any way to search pattern from the start of the file to the end? (I useually search forward and then backward but ...
1
vote
1answer
192 views

how to delete a file with the `less` pager

Usage I'm viewing a file with less and I want to delete it. (I go over my day's scratch notes in less because it's fast and can easily handle dozens of notes, and sometimes I want to delete a note.) ...
0
votes
1answer
18 views

Open a protected file form within man page/less?

I was reading the man page for firewalld.service and I wanted to open up the service.xml from within the man page (which I believe is less). I know :e would do the job if I had permissions, but ...
2
votes
2answers
185 views

Smart word wrapping in `less`?

I use the Python package rtv as a terminal client to read Reddit. When it gets to a large text box, it calls less display the text. Currently, less wraps the words according to column width, meaning ...
1
vote
0answers
22 views

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 ...
-1
votes
1answer
36 views

Which CSS pre processor is better and most used: SASS or LESS? [closed]

Before someone may asks, I searched for questions about this but didn't find anything close to that subject. Additionally, if my question is in the wrong place, please let me know and point the ...
3
votes
1answer
398 views

Display Ruler Information in less (cursor position)

Sometimes, if I know I'm not going to do any edits in a window, I use less instead of vi. However, vi displays percentage and cursor position in the bottom right corner. Is there a way to mimic this ...
0
votes
1answer
1k views

Scrolling down while selecting text in PuTTY

Is there anyway we can copy large amount of text to Windows clipboard from file opened through less command? While it's easy to select text that is appearing on the screen, but how to continue ...
1
vote
2answers
78 views

Watching logs with less +F freezes after a while

less +F is a great command for watching logs, but it has very annoying issue. After a while it stops updating log file and requires restart. Is there any way to make it follow file forever?
1
vote
0answers
68 views

Multi-page output :: text select with tmux over ssh

I have a local terminal within tmux. Now I connect to a remote server via SSH and run some command piped to less. With tmux I can easily select part or the entire screen, however I can not select text ...
5
votes
2answers
2k views

Keep color in less after make and pipe

I would like to keep color in less command after using "make 2>&1" to compile some program. There are similar topics with "grep" and "ls" commands but solutions do not work with this command. For ...
2
votes
1answer
44 views

Dump to terminal or file content of “less” pager utility

It is usual to use less utility as pager (with -r option). But less uses special terminal buffers, so it preserve previous output to terminal and when I leave less I see previous content. That is ...
0
votes
1answer
334 views

Make less use alternate screen, but only if entire file won't fit on one screen

I'd like less to quit immediately if the entire file can be displayed within one screen. For this, I'd use the -F option: -F or --quit-if-one-screen Causes less to automatically exit if the ...
2
votes
1answer
55 views

Various environments and weird less behaviour

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 ...
0
votes
2answers
285 views

What's the behaviour of `cat | less`?

I tried to run the following command: cat | less I know both commands require something from the standard input. When I run it that's what I expected: all my inputs goes to cat and I will not be ...
2
votes
2answers
550 views

less with -F option and pattern matching

From a script, I want to invoke less on a file and have it print the output to the console, rather than a new screen. If the file is short enough to fit on one screen, I want to disable scrolling. If ...
2
votes
1answer
119 views

How to get fish-style formatting with less

Let's say I run a command like ls in fish and get lots of output, how do I scroll through it and still keep the fish formatting or something like it? ls | less doesn't keep the formatting. I know ...
22
votes
1answer
4k views

Pipe to less but keep the highlighting

Is it possible to pipe output (e.g. dmesg) to a command like less (or equivalent) and keep the text highlighting used by the original command? example: on the left dmesg | less on the right dmesg
52
votes
1answer
3k views

How does less display PDFs?

I have tried several programs: pdftotext, pdf2txt.py, ... All of them can extract text from PDFs, but the one which is doing the better job is good ol' less: the text from the PDF has a proper layout. ...
1
vote
1answer
461 views

combining tail -f with less +F does not work

I am using ubuntu bash. I am trying to combine tail -f and less +F like below and nothing is coming out. tail -f long_running_log | less +F long_running_log is a log file constantly being written ...
18
votes
4answers
2k views

Linux command line log viewer which allows auto tail AND searching?

I use tail -f in my Linux shell, to view log files, as I like how it auto-updates with the incoming text: I like to see the new stuff come scrolling in. However, I also like the search functionality ...
1
vote
0answers
173 views

Can vim be used to view a growing file?

I often use vim's view for viewing files. Is there a way to use it for a growing file so that I can see the progress as it's happening? Something similar to tail -f or less +F I have two use cases:...
1
vote
1answer
312 views

How do I set $LESS invocation options in a lesskey file?

I'm trying to use less's lesskey-file support, as described in the manpage: KEY BINDINGS You may define your own less commands by using the program lesskey (1) to create a lesskey file. This ...
2
votes
0answers
241 views

Neither less or less -X clear screen on exit. (Trust me, I googled…)

Neither less or less -X clear screen on exit. At the same time, vim does.... Env iTerm2, protocol mosh, server Centos + tmux + zsh iTerm2: report term as xterm-256color tmux: set -g terminal-...
3
votes
1answer
3k views

How do I make less open binary files without confirmation?

I have several log files that contain a few bytes which are not displayable characters (due to binary signatures on the requests). Every time I open them with less I get asked: $ less /var/log/file....
0
votes
1answer
311 views

less maximum buffer size?

I was messing around with my system and found a novel way to use up memory, but it seems that the less command only holds a limited amount of data before stopping/killing the command. To test, run (...
4
votes
1answer
8k views

Less - Select to clipboard

In Less (Linux terminal), I can select lines with the mouse and then use Ctrl+Shift+C to copy to the clipboard. This only works within the displayed part of the terminal. How can I select more text? ...