Skip to main content

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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 views

Tmux copy-paste with mouse mode on while using the `less` command

Hopefully this is not already answered, given that there are 100s of question specifically about tmux copy-paste on mouse mode. I am specifically trying to copy text using mouse selection while using ...
Ayush Goel's user avatar
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 ...
Anton Samokat's user avatar
6 votes
2 answers
776 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 ...
fire84392's user avatar
7 votes
1 answer
468 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 ...
Wildcard's user avatar
  • 36.7k
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 ...
mohamadi_arch's user avatar
0 votes
0 answers
51 views

LESSOPEN not working

LESSOPEN not working for me, don't know why. In ~/.bashrc currently I have: export LESSOPEN='| nl %s' export LESS=' -R -i --use-color' export LESSSECURE=1 but LESSOPEN doesn't seem to work. LESS ...
sZpak's user avatar
  • 481
0 votes
1 answer
49 views

Restrict the number of colums for man (or less)

I use man pages in the console a lot (no GUI), but the wide screen I use really has a lot of columns in text mode. The lines are too long and unpleasant to read. Is there a way to limit the number of ...
fleetingbytes's user avatar
0 votes
3 answers
165 views

open man (or info) pages from the same position where you left off last time

I treat man pages is the primary source of documentation about installed software. I would like to use them not only as a reference, but actually read them from beginning to end. And here comes the ...
Sergey Guzenkov's user avatar
0 votes
1 answer
40 views

Buffering follow + automatic pagination of output

I have a utility that continuously outputs live logs from a program. But it can be quite hard to read the logs lines as they scroll past me in the terminal. Ideally it should scroll to one full page, ...
David S.'s user avatar
  • 101
-1 votes
2 answers
147 views

Why is there "==> append : to filename to view the PDF source" at the beginning of the output of `less` on pdf files

When I use less to view the text part of a pdf file, I get ==> append : to filename to view the PDF source appended to the beginning of the output. Why does that happen? How can I suppress it? $ ...
Tim's user avatar
  • 103k
3 votes
3 answers
398 views

How to copy matched line in less?

I want to copy matched line that is too long that cannot select with the mouse in less, so does there exist another way in less? For example File: test.txt content is: line1: 12312sdfas23414123 liie2: ...
Yang Xu's user avatar
  • 93
0 votes
0 answers
52 views

Is it possible to save a less session and return to where you've left a mark?

I'm reading through the man page and so far the only thing I can find is --save-marks which doesn't save both my reading mark and session when I open up my pdf file in less again, this is my first ...
DudlyDog's user avatar
1 vote
1 answer
196 views

Why don't these LESS_TERMCAP variables work on Oracle Linux?

I've been using these variables for a long time to colourise man pages: # Colourise man pages export LESS_TERMCAP_mb=$'\E[1;31m' # begin bold export LESS_TERMCAP_md=$'\E[1;36m' # begin blink ...
paradroid's user avatar
  • 1,203
1 vote
0 answers
249 views

Custom key combinations for command execution in a terminal change the terminal line settings

Problem description I would like to bind commands which I execute very often in a terminal to key combinations. The bind command appears to work at first. However, when I use the key combinations, ...
user13062187's user avatar
10 votes
1 answer
646 views

Issue viewing compressed file with "zless", but not with "zmore" or "gunzip -c"

On my FreeBSD 13.2 system, the zless utility cannot view text files compressed with gzip or compress, warning that they may be binary files and then showing garbage if I say I want to see the contents ...
Kusalananda's user avatar
  • 337k
4 votes
1 answer
172 views

Inside less, is there an equivalent of ctrl-Z to recover the pager prompt?

I will occasionally use the pickaxe functionality of git to locate changes of interest. This can be quite slow, obviously (the same would apply to, say, hg grep), but more significantly it is bursty: ...
Pierre Lebeaupin's user avatar
5 votes
0 answers
410 views

Searching for literal strings like '***' using less

In trying to search for the literal string ***, less puts up a couple roadblocks. The asterisk has a special meaning when used as the first character of the search pattern (ignore EOF). No problem, ...
Eric S.'s user avatar
  • 51
2 votes
1 answer
95 views

Scroll to the end in less without stretching out single-page input

When I pipe something into less --quit-if-one-screen +G (alias -F +G), less opens and scrolls to the end if the output exceeds the terminal size. Unfortunately, it also scrolls to the end before ...
xeruf's user avatar
  • 561
0 votes
2 answers
392 views

In less: how to enter as search pattern '(#'

Im less, version 590, I can enter as search pattern \( to search for an open parenthesis. And I can enter # (hash character) to search for this. But when I have to search for both two characters, open ...
Anton Wessel's user avatar
0 votes
2 answers
75 views

less option "--save-marks" does nothing when less is used as a manual pager

I use less version 590 (GNU regular expressions). I use export LESSFILE="/root/.lesshst_for_manpages" export MANPAGER="pager --save-marks -I" man -L en <<somemanpage>> ...
Anton Wessel's user avatar
1 vote
0 answers
85 views

Why bash for loop goes to stopped job when Ctrl+C is pressed?

Suppose I have a log file generated this way: yes | head -n 1000000 > log Now when I view it like this for i in log; do cat $i; done | less -S press Ctrl+C in less and quit it with q, some ...
ks1322's user avatar
  • 1,656
15 votes
2 answers
995 views

How can I disable `v` keybinding in less?

When I use less and press v it switches into the currently set editor (Emacs or vim). MISCELLANEOUS COMMANDS v Edit the current file with $VISUAL or $EDITOR. Is it possible to prevent this ...
alper's user avatar
  • 467
0 votes
1 answer
99 views

Search in whole .bash_history list with full-featured regex engine

When I have to search backwards in the .bash_history list I want to see the timestamps as were created by HISTTIMEFORMAT. And the results have to end up in a pager, where regex can be used for ...
Anton Wessel's user avatar
0 votes
0 answers
16 views

less: do not display "filename (END)" at the end of page [duplicate]

I need less to display a file without any additional formatting characters. I found the --tilde option, which got rid of the ~ characters. Now I only need to get rid of the: (END) or <filename> ...
Martin Vegter's user avatar
1 vote
0 answers
195 views

custom keybindings for less (lesskey)

the manpage says I can use $HOME/.lesskey file to define my own custom keybindings for less. It even shows some examples, such as ... n repeat-search \en repeat-search-all ... q ...
Martin Vegter's user avatar
1 vote
1 answer
388 views

simplest possible pager

In mc (midnight commander), I can define custom command for viewing files, ie: shell/i/.jpg Open=gpicview %f View=file %f | less The command file %f has to be piped to a pager. I am using ...
Martin Vegter's user avatar
6 votes
2 answers
1k views

What are these > at the right of unterminated lines, when I do a systemctl status or a journalctl for example?

When I do a sudo systemctl status elasticsearch.service or a journalctl -xe on Debian 11 I have this output: many lines are ended with > characters and I don't know how to handle these lines to ...
Marc Le Bihan's user avatar
16 votes
2 answers
2k views

How can I keep colouring when piping man to less?

I have this in my .zshrc file export MANLESS="" export LESS="--RAW-CONTROL-CHARS" export LESS_TERMCAP_mb=$(tput bold; tput setaf 5) export LESS_TERMCAP_md=$(tput bold; tput setaf 1)...
Martin Vegter's user avatar
1 vote
2 answers
56 views

How to terminate _follow_ mode in **less** (`+F`) from pipe?

Assuming the following dummy command in bash: ### dummy long_operation_cmd function, for easy reproduction: function long_operation_cmd() { echo "operation 1" sleep 5 echo "...
Lockszmith's user avatar
0 votes
1 answer
58 views

Merge multiple files and format output into columns with line wrap

I'm trying to show multiple files to a user within less. These files have relatively long lines and contain the same text but in different languages (differences in line length to be expected). ...
Venem's user avatar
  • 11
0 votes
1 answer
92 views

less command: b/f vs w/s

About the less and according with: Less command Linux / Unix Colored Man Pages With less Command indicates the following: f ^F ^V SPACE * Forward one window (or N lines). b ^B ESC-v * Backward ...
Manuel Jordan's user avatar
5 votes
2 answers
781 views

less command g vs p option

In less for navigation purposes according with this tutorial Less Command in Linux indicates: g Go to the first line in the file. p Go to the beginning of the file. I tested both, and of course ...
Manuel Jordan's user avatar
1 vote
1 answer
434 views

How to make less +F follow symbolic link if link changes

When you tail a file that is a symbolic link you can make tail follow the link if it changes with tail -F. Is there someone that have a solution to make less behave the same way if you're opening a ...
Björn's user avatar
  • 113
1 vote
1 answer
175 views

Auto page down / scrolling after a few seconds using more, less, or something similar

When using more or less, the output is paused at the end of each page. Is there some way to have it pause only for a few seconds (configurable or not), and then continue to the next page? Is there ...
entonio's user avatar
  • 113
0 votes
1 answer
46 views

where in the FHS does command less store its buffers?

Using Kubuntu 20.04, which is running from an USB stick. Therefore there is a /cow overlay file system mounted on /. The USB stick has a total capacity of 32 GB, But to the cow overlay file system ...
Anton Wessel's user avatar
1 vote
0 answers
235 views

How can I recursively search file contents by ANDed patterns and print the output like ag/the silver searcher would?

This will be easier to explain via example. Here are my input files: file1: x x a b c x x file2: x x c b a x x file3: x x x x a b c x x x x file4: x x x x c b a x x x x file5: x x a b x x file6: ...
Daniel Kaplan's user avatar
1 vote
1 answer
31 views

Should one report the output of valgrind to less developers?

I found that in Linux Mint, the command valgrind less outputs still reachable: 22,499 bytes in 31 blocks Is that a bug? Should one report this kind of issues to the developers?
novice's user avatar
  • 21
0 votes
0 answers
38 views

Want less cmd to clear content on exit in server

Want less cmd to clear content on terminal on exit in server and display back what was there before. I am used to this in my mac and wants the same behavior in the server. My internet search gives ...
MoonDash's user avatar
2 votes
2 answers
571 views

Is `git branch` using `less` a recent change? Or is `less` behaving differently recently?

Appologies for the vague title. I frequently execute git branch throughout the day, and it seems at some point recently (perhaps in the past month?) the behavior has changed. I recall previously git ...
STW's user avatar
  • 2,291
2 votes
1 answer
67 views

less: custom shortcut for previous searches (up-arrow)

The less viewer allows some customization using the ~/.lesskey file, but it does not seem to have any effect in the context of searching. For example, I can map ^P to the up arrow, and this works for ...
Byron Hawkins's user avatar
1 vote
1 answer
470 views

less -n default behavior, is not the same as indicated through man

For a MacOS and Ubuntu Server 20, with the command man less I can read the following: -n or --line-numbers Suppresses line numbers. The default (to use line numbers) may cause less to ...
Manuel Jordan's user avatar
2 votes
1 answer
723 views

Why the LESS_TERMCAP settings does not work when put it into ~/.profile

I have the following LESS_TERMCAP settings: # less config export LESS=-R export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking export LESS_TERMCAP_md=$'\E[01;31m' # begin bold export ...
Rubem Pacelli's user avatar
5 votes
1 answer
817 views

Using anchor ^ pattern when using less / search command

When navigating through Linux man pages, sometimes you need to query the meaning of flags like -p or -al in the man pages. The default text reader for man pages is less and I'm trying to use the / ...
Silver137's user avatar
  • 329
1 vote
1 answer
318 views

Does less block the input process from writing to stdout until the user advances a page?

I have a command which streams data from a server and writes lines to stdout. There is a large number of records that I would like to pipe to less, but I would like to prevent my tool from continuing ...
Brad's user avatar
  • 155
0 votes
1 answer
64 views

Make `less` exit after last page or `more` interpret colors

In a script, I’m doing a git diff that I want to quickly page through. When I’m finished, the pager will exit and the script will continue. more is great for the task, because I can space through it ...
user137369's user avatar
2 votes
4 answers
758 views

Why this word can't be grep?

I have access to busybox only, v 1.27. I'm trying to use a huge TXT file I extracted from a PDF document as a TXT dictionary, to be console friendly. The word I'm trying to get is the very first word ...
abacox's user avatar
  • 143
0 votes
2 answers
92 views

Search with less

In the output of wget --help I would like to quickly go to the place where the --header option is explained. I try searching with less. man less explains: /pattern Search forward in ...
Viesturs's user avatar
  • 943
0 votes
1 answer
39 views

How to add empty new lines in less (log viewer)?

When I monitor some log file with tail -F file.log, I can press enter to add some space between actual log lines and the new ones, for example: some log 1 some log 2 some log 3 some log 4 some log 5 ...
user's user avatar
  • 821
2 votes
1 answer
355 views

less: how to skip N files

From the less man page: :n Examine the next file (from the list of files given in the command line). If a number N is specified, the N-th next file is examined. How this number N can be ...
Jander's user avatar
  • 143
4 votes
1 answer
6k views

search last occurrence of string in less

What's the best way to search for the last occurrence of a string in less? ?string works for small files but doesn't seem to work with large or non-trivial syntax-highlighted files (eg, cat /var/log/...
sunnz's user avatar
  • 71

1
2 3 4 5
9