less shows a long file one screen at a time. Learn the movement keys, searching with /, and how to get out with q, by running the commands in a real terminal in your browser.
Updated: 2026-09-05
less [options] file
Shows a file one screen at a time. It is a read-only view, so the file itself is untouched.
The terminal on this page has a log file with 120 lines in it.
$ wc -l logs/app.log
120 logs/app.log
That is far more than one screen, so cat would scroll it all past you.
Open it with less instead.
$ less logs/app.log
The screen switches to the first page of the file. The bottom line shows which file you are looking at.
001 ERROR request failed
002 INFO request handled
003 INFO request handled
...
logs/app.log
Press q when you are done and you return to the prompt.
There are not many keys to learn.
| Key | What it does |
|---|---|
Space / f | Forward one screen |
b | Back one screen |
j / Down / Enter | Down one line |
k / Up | Up one line |
d / u | Half a screen down / up |
g / G | Jump to the top / bottom |
q | Quit |
G is the one you use most with logs.
Whatever was written last is what is happening now.
Type / followed by the text and press Enter.
/ERROR jumps to the next line containing ERRORn goes to the next matchN goes back to the previous oneFor a long log, counting with grep first and then reading the surroundings in less is an easy rhythm.
$ grep -c ERROR logs/app.log
8
less is where you go to read long output without rushing.
| Situation | What you type |
|---|---|
| Read a long log | less app.log |
| A listing scrolls off the screen | ls -l | less |
| Read with line numbers | less -N app.log |
| Read a manual page | man ls (it opens in less) |
q gets you out.
This is the single thing that catches people the first time.
It is a read-only view, so quitting changes nothing about the file.
Short files do not need it.
$ cat notes.txt
buy milk
call the bank
If it fits on screen, cat is quicker and leaves the text in your scrollback.
It is not an editor.
less only reads.
Use an editor such as vim when you need to change something.
webterm.appthis site
Advanced Terminal Commands
Learn commands for specific situations
learn.webterm.appa separate site

Commands stick when they show up in a real sequence of work, not one at a time. There is a course that builds them up in order.
See the course