Lurker News
TLDR: I wrote a handbook for the Linux command line. 120 pages in PDF. Updated for 2025. Pay what you want.

A few years back I wrote an ebook about the Linux command line. Instead of focusing on a specific shell, paraphrasing manual pages, or providing long repetitive explanations, the idea was to create a modern guide that would help readers to understand the command line in the practical sense, cover the most common things people use the command line for, and do so without wasting the readers' time.
The book contains material on terminals, shells (compatible with both Bash and Zsh), configuration, command line programs for typical use cases, shell scripting, and many tips and tricks to make working on the command line more convenient. I still consider it "an introduction" and it is not necessarily a book for the HN crowd that lives in the terminal, but I believe that the book will easily cover 80 % of the things most people want or need to do in the terminal.
I made a couple of updates to the book over the years and just finished a significant one for 2025. The book is not perfect. I still see a lot of room for improvement, but I think it is good enough and I truly want to share it with everyone. Hence, pay what you want.
EXAMPLE PAGES: https://drive.google.com/file/d/1PkUcLv83Ib6nKYF88n3OBqeeVff...
https://commandline.stribny.name/

Comments (109) 30 threads

Show all comments

Showing thread 13 of 30

dedicate6 replies#
It makes me wonder – what's that one command or concept you CLI vets wish you'd learned way earlier that totally changed your game, something that might be in that 'next 20%'? Curious about those 'aha!' moments!
justusthane1 reply#
Get really comfortable with find and grep. They’re incredibly powerful. perl -pe is way easier than awk.
jcynix1 reply#
I'll second that. And would like to add that find plus xargs is important to know, as it often works much better than the clumsy "exec in find itself.

Oh, and thus of course

    find ... | xargs perl -lne "fancy stuff"
to do some fancy stuff with found files ;-)
geocar#
I really think you should use:

    find ... -exec perl -lne "fancy stuff" {} +
because for one it doesn't mess with stdin, and for another you don't have to worry about filenames with spaces or newlines in them. I also like -execdir since if my script dumps any output to other files I'll probably want that output near the sources. And did I mention it does nothing if there are no matching files? I also think it looks better and is shorter.

If you really can't remember that or want to continue to pollute the environment with extra heat generated by running two cpus to do the job one can do, you should at least use -print0/xargs -0 because of spaces, and always use -r to more sensibly handle an empty result-set from find et al (gnu xargs runs once!)

petr251020181 reply#
One of my favorites from the book is to alias "xdg-open" to "open" because I never remember the command. So now I can just type "open X" to open a file system location or file in a normal GUI program when needed. It is a small thing but I use it a lot.

Something that I didn't put in the book because I learned it only recently is the use of "notify-send", aka you can send yourself a system notification from the command line or script (at least it workd for me in Gnome). For instance once a task is finished:
> echo "when finished send notification" && notify-send "system notification"
Pretty cool if you ask me!

litoE1 reply#
In my Linux install (Debian 12/Bookworm) /usr/bin/open is a symlink to /usr/bin/xdg-open so I was always using xdg-open without even knowing it.
petr25102018#
Great somebody thought of it!
calvinmorrison#
the basics of awk and perl, these days jq as well.
smw#

  bat     # cat with syntax highlighting
  zoxide  # keeps track of directories
  tig     # ncurses git viewer
  atuin   # shell history across machines
  choose  # easier cut or "awk '{print $1}'"
  direnv  # set environment vars when you enter a directory
  fd      # better find
  fzf     # fuzzy find anything, total game changer
  gh      # GitHub client
  rg      # really fast recursive grep
magarnicle#
These might seem basic but they made a huge difference when I learnt them:

  set -o vi
  set -o xtrace
  xargs, xargs -I
  parameter expansion (see the Parameter Expansion section in the bash manual)
  ctrl + r
  find -exec
  lsof
bionsystem#
grep, sed, awk and regular expressions would probably be part of my 1st hour course if I were to produce one. And by awk I mean the super basic stuff like -F',' '{print $3" "$NF}' is already a long way

also any command | while read line; do something $line; done
and find and vi of course