Skip to Content
Navigation:

A stick figure smiling

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". get the zine!
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

  • / search
  • n/N next/prev match
  • j/k down / up a line
  • m/' mark/return to line
  • g(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 updates
  • less +G: start at end of file
  • less +20%: start 20% into file
  • less +/foo: search for ‘foo’ right away