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.

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

"less" stopped wrapping on Debian Bookworm

As it says in subject: it does NOT wrap text in terminal anymore and there does not seem to be any option in manpage that says how to force it to wrap long lines. Please advise how to force less to ...
LetMeSOThat4U's user avatar
1 vote
1 answer
24 views

Can I modify the exit key for the less command in ubuntu?

Is there any way to customize the less command to exit using a key other than 'q'? EDIT I have tried creating a file called lesskey under $HOME/.config with the following contents: #command \b quit ...
Dan's user avatar
  • 113
0 votes
1 answer
82 views

cli program `less` interprets a file as binary when it is utf-8 text

I have a file that has non-ascii, UTF-8 characters in it. When I use less to view that file I get a warning saying may be a binary file. See it anyway? But the file is clearly not a binary. And when ...
Paul's user avatar
  • 205
0 votes
0 answers
24 views

How do I make less look like a terminal to programs attached to its input?

Questions like "How do I get grep to pipe color output to less?" explain what flag to give to grep so it'll ignore the fact that less isn't a regular terminal. Is there a way to fool an ...
John Baber-Lucero's user avatar
0 votes
0 answers
15 views

In less, what's the matter with the <End> 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 ...
Anton Wessel's user avatar
0 votes
1 answer
127 views

how to chop (truncate) long lines in bash output to fit in the screen with?

I love piping any output into less -S because it prints neatly without wrapping long lines of output into new lines (especially for tables). However, I wonder if there is a way to truncate long lines ...
ricardo3889's user avatar
0 votes
0 answers
66 views

less does not obey env LESSHISTFILE

I use less version version 590 (GNU regular expressions) 1984-2021 Mark Nudelman I was informed to install the version 602 since therein the bug with colored input and -R is fixed. But this is until ...
Anton Wessel's user avatar
1 vote
0 answers
74 views

In less cmd, I cannot use mouse to select characters expect press Shift button. Why?

Refered to this post, I had set export LESS='-riF --mouse --wheel-lines=3', and solved the scrolling problem, but I coundn't select any charaters on the screen except pressing SHIFT button. This is ...
Robin.Cai's user avatar
1 vote
1 answer
134 views

`less -R` vs `less -r`: Why do colors only work partially in `-R` mode?

I've been confused by the following behavior of less many times: # setup some test data echo -e "foo\nfoo\nfoo" > /tmp/foo echo -e "bar\nbar\nbar" > /tmp/bar # now pipe ...
bluenote10's user avatar
0 votes
0 answers
118 views

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 ...
Tim Daubenschütz's user avatar
0 votes
1 answer
38 views

How to go to N-th file as described in the man file for less [duplicate]

I love using less to browse files. I often like to move through multiple files. In the man file it says that one can move N files forward: :n Examine the next file (from the list of files given in ...
Cornelius Roemer's user avatar
0 votes
1 answer
248 views

Indent wrapped lines using less

Using less you can wrap long lines with -S or --chop-long-lines. Is there any way to indent those wrapped lines?
shishax's user avatar
1 vote
1 answer
44 views

DIfference between `less mount` and `mount | less`

I was trying to look at the output of the mount command. less mount gave the following error: (base) jafar_isbarov@jafar-IdeaPad-3-15ADA05:~$ less mount mount: No such file or directory When I ran ...
Jafar Isbarov's user avatar
3 votes
1 answer
497 views

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&...
Paul's user avatar
  • 103
2 votes
1 answer
4k views

How to go to the next found result when using the less command on a log file in Linux?

I have a log file where I can use less on the file where I know how to go to the bottom of the log file with a shift+G and then use ? to query in the text file. What I don't know how to do is when I ...
bbartling's user avatar
  • 195
0 votes
0 answers
395 views

Pressing q does not exit in less running in tmux

How to exit file reading mode (in less) in Linux terminal? To quit less, type q. I am using tmux on remotely connected node using ssh. I am connecting into host as follows: ssh -xt4C username@host. ...
alper's user avatar
  • 156
3 votes
0 answers
39 views

How do I see current status of runtime options of less utility?

Less takes runtime options from LESS environment variable + system-wide lesskey file + $HOME/.less file + command line arguments + runtime commands invoked by user. Use case After toggling some ...
maoizm's user avatar
  • 1,053
0 votes
1 answer
596 views

The closest thing to 'less -S' using pre-installed Windows command-line tools?

What would be the best way to chop long lines of output (and do some horizontal scrolling perhaps, but I'm not holding my breath) on Windows, using Windows command-line tools like more. I want to ...
Budiman Snowman's user avatar
1 vote
1 answer
146 views

Tuning vim's less.sh: enabling persistent search history

So, I'm using vim's less.sh in place of standard less pager: alias less=/usr/share/vim/vim81/macros/less.sh However, I have a major and a minor problem with it. The major issue is that it does not ...
alamar's user avatar
  • 133
0 votes
2 answers
1k views

less command does not open zip files on debian

Here I am using debian/testing distribution on my machine but there is something interesting. # less file.zip "./file.zip" may be a binary file. See it anyway? Do I need to install some ...
M.J's user avatar
  • 125
1 vote
2 answers
144 views

How to exit less follow mode without exiting less when xargs is used?

ls -rt *.log | tail -1 | xargs less +GF I use this command to tail -f my logs, but when I ctrl+c to exit follow mode, it quits less too. I think it is caused by xargs, because if you just less <...
Shuman's user avatar
  • 231
1 vote
1 answer
415 views

Unblock "less" after follow mode / scrolling past end of buffer

I'm using less to capture the output of a live program. Using F activates follow mode, showing me real-time output. However, after entering follow mode (or, more generally, scrolling past the buffered ...
loopbackbee's user avatar
  • 1,411
0 votes
2 answers
257 views

less -R does not show colors when processing ANSI colored text via a pipe

The command terraform show does NOT show colored text but the command terraform show | less shows output with what seem to be text color codes: ESC[0m#module.vpc.module.label.data.null_data_source....
Oliver's user avatar
  • 143
3 votes
0 answers
462 views

How can I paginate Docker commands?

The output of some Docker commands (such as docker container ls) takes a lot of space of my terminal, causing a lot of line breaks, which makes the reading to be a frustrating task. So I wondered if ...
Luiz Felipe's user avatar
1 vote
2 answers
349 views

Italics work everywhere except in less(1)

I followed (and modified) this Reddit post to get italics working in Terminal.app and in tmux(1). Italics work The command echo -e "\e[3mfoo\e[23m" outputs foo (with italics) in both a regular ...
D. Ben Knoble's user avatar
1 vote
1 answer
143 views

git log -<number> does not work in Combination with LESS env Variable

I want git log or git diff to clear the screen when I quit. I followed this instruction and added export LESS="FR" to my .bashrc, so that git does not add the X option to the less command (see pager ...
stollr's user avatar
  • 192
2 votes
2 answers
1k views

Mouse scrolling less pager output in tmux session

I use export LESS=-R to enable scrolling through less output using mouse scroll. It doesn’t work in tmux. For vim, the solution was to add set mouse=a. What is the equivalent option for less assuming ...
Ilias Karim's user avatar
0 votes
1 answer
109 views

Have utilities like vim and less source .bash_login or .bashrc for command lines

When I try to enter an alias into the less or vim command lines, they both print “/bin/bash: [MY ALIAS]: command not found” This alias is defined in .bashrc or .bash_login and is there a way to ...
Ilias Karim's user avatar
1 vote
2 answers
197 views

`vim | less` breaks things

This is the best place I found for my question. Running vim | less from inside gitbash will cause it to do something that I can only describe as "breaking." Usually I can get the less ...
PoolloverNathan's user avatar
1 vote
3 answers
337 views

`less`: multiple commands, including a search

Imagine you would want less to auto scroll to the end. Easy, as its manual states, do less +G. Imagine you would want less to start at the beginning but after soaking its whole input. Easy, do less +...
174140's user avatar
  • 94
0 votes
1 answer
40 views

When I press up-arrow in 'less' in mintty (cygwin), only the top line changes. How do I fix this?

Here is what is happening: How do I fix this? (Just to be clear, the issue occurs when I type less <any filename>. The man less in the gif is just an arbitrary command to demonstrate the ...
Kyle's user avatar
  • 101
0 votes
0 answers
152 views

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 ...
Paolo Benvenuto's user avatar
2 votes
1 answer
119 views

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. ...
3N4N's user avatar
  • 128
0 votes
1 answer
31 views

Is there a way to run less without reverting the screen afterward? [duplicate]

I much prefer less over more for paging output since it has a much nicer command interface. However, it has the very annoying feature of clearing the screen back to its original state on exit. The one ...
Systerious Manger's user avatar
0 votes
2 answers
2k views

Less Compiler is not working in PHPStrom 2018.3

I am using PHPstrom 2018.3 (latest Version). I am getting this error while I am using less to compile through file watcher. Failed to run File Watcher ', Less'. The watcher has been disabled. Error: ...
punit shrama's user avatar
0 votes
1 answer
35 views

less +F but tracking file by name, not inode

I'm looking at log file but it's renamed (logs rotation mechanism). How do I see actual logging file in less-like fashion, so I can stop updating for a while and then continue?
George Sovetov's user avatar
1 vote
1 answer
167 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 ...
ted's user avatar
  • 166
0 votes
0 answers
32 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 ...
jnns's user avatar
  • 231
11 votes
2 answers
544 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 ...
isomorphismes's user avatar
0 votes
1 answer
208 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 ...
brainwash's user avatar
  • 121
1 vote
1 answer
481 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 ...
rogerdpack's user avatar
  • 2,146
0 votes
0 answers
21 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 ...
Svalorzen's user avatar
  • 113
0 votes
1 answer
185 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 ...
einpoklum's user avatar
  • 8,814
1 vote
1 answer
2k 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 ...
Tomilov Anatoliy's user avatar
1 vote
2 answers
53 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 ...
user43850's user avatar
10 votes
2 answers
28k 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 + ...
ultracrepidarian's user avatar
1 vote
2 answers
5k 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 ...
Mike Dannyboy's user avatar
0 votes
3 answers
142 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. ^...
Magnus's user avatar
  • 4,156
0 votes
1 answer
475 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 ...
user755769's user avatar
13 votes
3 answers
7k 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 ...
Dan Stevens's user avatar