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 used to view (but not change) the contents of a text file one screen at a time. Questions regarding the use of less in Ubuntu should go by this tag

3
votes
1answer
393 views

less calls nano instead of vi

In the default configuration of Ubuntu 18 LTS server, pressing the V key in less calls the nano editor instead of vi while none of the environment variables $LESSEDIT, $VISUAL or $EDITOR are set. I ...
1
vote
1answer
102 views

Count Lines Viewed from command 'less'

I run command less ls /usr/bin | less got many lines of directories. 2to3- 2to3-2.7 AssetCacheLocatorUtil AssetCacheManagerUtil AssetCacheTetheratorUtil BuildStrings CpMac ... How to enumerate ...
2
votes
1answer
74 views

less goto line requires me to type ':' twice

Here is the behaviour im seeing: http://www.giphy.com/gifs/MWuSbME041h8cmDqer A short description is that when i type man bash | less, i need to type ::100 instead of :100 in order to move to ...
3
votes
1answer
161 views

No output from some paginated commands (man, git log)

Something has gone wrong with both the man and git log commands on my Ubuntu system over the holidays. Neither produce any output, and I have no clues as to what the issue is, bar that they both ...
6
votes
1answer
182 views

How does “less” switch to the text, then back to the prompt?

When I run less on some file, the prompt goes away, and I get the contents of the file on screen. Then when I press q, it goes back to the prompt. I think less does this by saving the current terminal ...
9
votes
3answers
968 views

EDITOR environment variable changes after reboot

While running the less command, pressing v opens the file inside the editor. I have set the EDITOR environment variable to vi by running the command export EDITOR=vi. It works perfectly fine as ...
1
vote
1answer
79 views

less command option % is not working - no such file or directory

I successfully opened a file with less command. Then I typed ! for shell command. In the shell I typed du -h %. % is supposed to be the file name to the shell. However it is not working. Shell replies ...
12
votes
5answers
904 views

View files without lines with certain string

Searching for a program like tail or less which let me view my logs without lines that contain a certain string. For example view my syslog without UFW ([UFW BLOCK]) entry lines.
1
vote
0answers
56 views

How do I combine the 'less' and 'head' comands?

I am attempting to preview a PDF in the terminal on Ubuntu 17.04. I can view the PDF clearly using the 'less' command, but it shows the entire file. If I use the 'head' command, I get the first 10 ...
9
votes
3answers
2k views

How can I stop following output in less, without affecting the command generating the output?

I am running a server and the log of this server gets logged in terminal, not in any file. I would like to use less to view this log. node server.js | less When I just want to see the log, I use ...
4
votes
1answer
328 views

man pages - How to always show total lines and percentage in the bottom status / prompt line

I want to always see the total lines and % part ( line 1/773 0% ) in the bottom status / prompt for man pages immediately upon viewing one. When I open any man page I see this in the bottom line: ...
0
votes
0answers
22 views

less -z4 command's display

I am trying to use the less -z4 /var/log/syslog command to display 4 lines by 4 of the syslog file .However, it displays multiple lines. I am wondering what happens? and if we can use other option ...
3
votes
1answer
111 views

colors of bold section in man pages

After upgrade to 16.04 I hit the issue with colors of some sections in man pages e.g. color of bold is black and when I read man pages in terminal with black background there is no possibility to see ...
2
votes
2answers
124 views

Gnome terminal, `less` opens file at the cursor position, not at the top of terminal

If I try to open a file with less, its content starts from the cursor position, not from top of the screen. . This happens only in gnome-terminal, for example in Terminator everything is ok. How ...
6
votes
2answers
723 views

View text in terminal with specific patterns highlighted

I want to view text (could be a file or a piped command output) in the terminal, but I would like to highlight a specific pattern in the text with colors, similarly to how grep highlights the pattern ...
3
votes
1answer
737 views

How can I build a scrollable, colored syslog viewer with less, ccze, grep?

I'd like to view logfiles with colored output, scrollable and searchable. How do I do that? I tried less /var/log/syslog | ccze | grep error, but it is not scrollable.
6
votes
1answer
2k views

Why do vim and less have such similar keybindings?

Do they share code, or is that just a tradition? Are there any other programs with similar keybindings?
2
votes
0answers
38 views

line width too long

I am using laravel and running php artisan route:list and when i press enter the output is a grid of columns representing the name of the route, the uri, the action, and other columns. But the text ...
3
votes
4answers
1k views

Is there a way to read characters backwards from the end of a file in the terminal?

For instance, less allows you to read line by line, starting from the beginning. Is there a similar utility or line that could be run in the terminal that could display a file backward character by ...
8
votes
3answers
11k views

How do i install less css compiler?

I just installed less css compiler using npm. Now thelesscfile directory is /usr/local/bin/lessc . i'm not clear what i need to change in lessc file and how to understand that compiler has been ...
14
votes
2answers
7k views

What is the default PAGER used by man pages?

What is the default PAGER used by man pages. I,e what is the program runs the man pages? It look some like more or less. I'm sure it's not more since more doesn't support reverse backward.
3
votes
2answers
106 views

How do I keep the screen contents after quitting less or more?

After exiting from less or more, the screen contents are returned to what they were before. This happens with pagers like less/more, and some other commands. Sometimes it is necessary to keep the ...
1
vote
2answers
311 views

how to use mysql with less and -F

I want to use less as a pager for mysql client. I want to add -F to force quit for short outputs. But I can't combine both correctly. root@jupiter:/# mysql -p -u root -h localhost --pager=less -F ...
18
votes
1answer
1k views

How can I redirect what is shown on Terminal to a file, when using the 'less' command?

How do I redirect the Terminal content (the content that currently I'm looking not the entire file, when using the less command) into a outfile until I press the Q to exit from less?
1
vote
1answer
292 views

more or less pager - how to quit [duplicate]

Idiotic question of the day On Ubuntu 12.04 server console, I've run an apt-get update followed by an apt-get upgrade Everything was going swimmingly; when it got to MySQL, it warned me it was about ...
0
votes
2answers
48 views

default behavior of less on .iso files

I use ubuntu 14.04 and have the following problem. Searching this website doesn't turn up anything and neither does google. I work with some data files that have a suffix .iso. These are simple ...
1
vote
2answers
287 views

How to get the long 'less' prompt with sudo?

I have added the following to my user's .bashrc file to get a longer prompt in less: export LESS="-M" This is added to the root user's .bashrc file as well, so when I sudo bash to get a root shell, ...
1
vote
1answer
756 views

sublime text 2 and less2css issue

On ubuntu 14.04 I have installed Sublime Text 2 and a plugin named less2css. When I try to save, for example MAIN.less, file is saved, but isn't compiled into MAIN.css. Sublime alerted me that usr/bin/...
20
votes
2answers
14k views

How do I make `less` output colors?

When I run a program (for example grep or ls) without a pager, its output is colored. However when I run it piping its output to less, no colors are shown. For example, this command outputs colored ...
0
votes
1answer
97 views

less.vim not working on my Ubuntu 12.04 lts

I found many sites saying that vim can be used as a pager like less with syntax highlighting. So to make it work I added this line to my .bash_aliases file: alias vless='vim -u /usr/share/vim/vim73/...
8
votes
2answers
2k views

Less output does not show output in terminal after quitting it

Previously, if I ran something | less, and then press q, it used to return me to the prompt with the output of less still visible. $ seq 1 100 | less 1 2 3 4 :q $ <prompt here. I can still see the ...
3
votes
2answers
2k views

How to use pygmentize automatically with less [duplicate]

I found pygmentize thanks to this answer, but it would be great if it could be used to highlight text with less or maybe replace the command. Is there a way to do that? Thanks in advance.
12
votes
2answers
6k views

How can I stop less from storing history?

Every time I search for a term in less, it stores my search in the file .lesshst. How can I stop this behavior?
44
votes
2answers
39k views

“less” doesn't automatically decompress gzipped files

On Fedora/Redhat/CentOS the less command seems to magically detect a gzipped file and decompress it on the fly, so you can do: less my_stuff.csv.gz I've just noticed this doesn't work on Ubuntu 11 ...