![A stick figure smiling](/images/welcome.jpg)
Here's a preview from my zine, Bite Size Command Line!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
![Image of a comic. To read the full HTML alt text, click "read the transcript".](/images/uploads/less.png)
read the transcript!
less is a pager
that means it lets you view (not edit) text files.
man uses your pager (usually less
) to display man pages
many vim shortcuts work in less
/
searchn/N
next/prev matchj/k
down / up a linem/'
mark/return to lineg
(gg
in vim)/G
beginning /end of file
less -r
displays bash escape codes as colours
try ls --color | less -r
with -r
:
- a.txt
- a.txt.gz
(red, bold)
without -r
- a.txt
ESCLOM ESC C01;31ma.txt.gz ESCCOM
(ugh)
or piped in text
q
quit (smiley face)
v (lowercase)
edit file in your $EDITOR
arrow keys, Home / End, PgUp, Pg Dn work in less
F
press F to keep reading from the file as it’s updated (like tail -f
)
press Ctrl+C to stop reading updates
+
+
runs a command when less starts
less +F
: follow updatesless +G
: start at end of fileless +20%
: start 20% into fileless +/foo
: search for ‘foo’ right away
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!