How to Use the Less Command

Traducciones al Español
Estamos traduciendo nuestros guías y tutoriales al Español. Es posible que usted esté viendo una traducción generada automáticamente. Estamos trabajando con traductores profesionales para verificar las traducciones de nuestro sitio web. Este proyecto es un trabajo en curso.
Create a Linode account to try this guide with a $ credit.
This credit will be applied to any valid services used during your first  days.

What is Less?

On Linux systems, less is a command that displays file contents or command output one page at a time in your terminal. less is most useful for viewing the content of large files or the results of commands that produce many lines of output. The content displayed by less can be navigated by entering keyboard shortcuts.

Invoking Less

To view the content of a file with less:

less your-file-name

To view the output of another command with less, redirect the output from that command using a pipe:

ps -ef | less

To see line numbers on each line, use the -N option:

less -N your-file-name

Keyboard Navigation in Less

Use the following key commands to navigate through content viewed by less:

Key commandAction
down arrow key, enter, e, or jMove down one line.
up arrow key, y, or kMove up one line.
space barMove down one page.
bMove up one page.
right arrow keyScroll horizontally to the right.
left arrow keyScroll horizontally to the left.
gGo to the first line.
GGo to the last line.
10gGo to the 10th line. Enter a different number to go to other lines.
50p or 50%Go to the line half-way through the output. Enter a different number to go to other percentage positions.
/search termSearch forward from the current position for the search term string.
?search termSearch backward from the current position for the search term string.
nWhen searching, go to the next occurrence.
NWhen searching, go to the previous occurrence.
m``<c>Set a mark, which saves your current position. Enter a single character in place of <c> to label the mark with that character.
'``<c>Return to a mark, where <c> is the single character label for the mark. Note that ' is the single-quote.
qQuit less

This page was originally published on


Your Feedback Is Important

Let us know if this guide was helpful to you.


Join the conversation.
Read other comments or post your own below. Comments must be respectful, constructive, and relevant to the topic of the guide. Do not post external links or advertisements. Before posting, consider if your comment would be better addressed by contacting our Support team or asking on our Community Site.