Questions tagged [less]
less is a terminal pager program used to view (but not change) the contents of a text file one screen at a time.
425 questions
0
votes
3
answers
55
views
Navigating files in less, with view autoscrolled to last file's view start line?
I know that I can open multiple files in less, and I can navigate between them using :n and :p - however, each time next or previous files are opened, less also scrolls the view to the first line in ...
5
votes
1
answer
420
views
Search both directions with less or similar tools
I want to be able to search entire page instead of just below (/) or above (?). Is this possible?
As of now I have to navigate to top of a page and perform forward (/) search, I would rather prefer ...
0
votes
2
answers
91
views
Never exit "less +F" if the tailed file disappears?
Under ubunu 22.04, I'm using the standard less pager.
When running less +F against a log file, I never want less +F to automatically exit if the log file disappears. Instead, I want the current view ...
1
vote
1
answer
60
views
less +S rings bell on first screen?
As a result of the answer to this question, I have begun setting LESS=+S.
However, I have discovered that this causes less to ring the terminal bell on the first screen.
This happens on the first ...
1
vote
1
answer
124
views
Using "less" as a pager with conditional exit and input forwarding
How can I use less with the following requirements?
I want to use less and scroll up and down with the arrow keys.
If the entire output fits on the screen, less should automatically exit.
When I type ...
0
votes
1
answer
63
views
Why does this display output: ls 1>/dev/null | less
If I do this: ls 1>/dev/null then as expected there is no output to the screen because it's been redirected to /dev/null
However, if I do this ls 1>/dev/null | less I see the file listing of the ...
5
votes
1
answer
308
views
Cannot fg a zsh function including less
I have this zsh function:
f() {
/usr/bin/find . -type f | less
}
When I run this function, suspend with Ctrl+z, and then run fg, it displays zsh: suspended (tty output) /usr/bin/find . -type f | and ...
0
votes
1
answer
118
views
Does "less" have "--retry" option like "tail"?
I'm using less to continuously trace Squid log file (as well as UFW log) with this command:
less --follow-name -K +F /var/log/squid/access.log
And at the time of rotation of Squid log less quits. I ...
0
votes
0
answers
80
views
less - how to make it not split lines for lines that are too wide when it starts?
I have output that is very wide (output from a sql query) and that, when I start less, is split into multiple lines, difficult to understand what is what... If I press on the right arrow, less will ...
8
votes
1
answer
926
views
Customize the man command's status prompt to show percentage read
I like the man command's status prompt to be customized. The default as picked from its own man page is like this,
Manual page name(sec) line x
But, having it show me the percentage of contents read ...
1
vote
1
answer
601
views
less on MacOS and zsh not showing colors
Solved, problem was in ls binary, that I replaced with (for some unknown reason) and its colorizing options are different to ls. However, leaving this post since it contains very useful debugging tips....
7
votes
3
answers
1k
views
How can I make a custom header in less? Or alternatively, how can I open two files simultaneously in less?
How can I prepend some custom text when opening a file in less?
For example, I would like to see something like:
My custom title
Content of the opened file goes here...
I want a command for that ...
7
votes
2
answers
2k
views
Is it possible to dynamically refresh journalctl with less?
I'm using less to view my journalctl logs because it's more convenient. It doesn't clutter the console window with logs after you exit less and you can scroll using your mouse wheel.
journalctl --unit ...
7
votes
1
answer
831
views
Why does `less` show "This account is not available" when run on a file from a root login shell?
This is not really a problem, just a peculiarity that I'd like to understand.
If I get a root shell with sudo bash -l and then run less somefilename I get less only showing:
This account is currently ...
6
votes
4
answers
2k
views
How do I add line numbers to the man page?
How can I add line numbers to man pages or info pages in Linux?
I want to use line numbers to navigate in man pages.
I can write the man page in a file and then open it with Vim, but is there a better ...