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

Earlier comments
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

JulianWasTaken1 reply#
Looks very nice!

I have an interactive tutorial I wrote and teach with which is here: https://github.com/JulianEducation/CommandLineBasics in case it's useful as well. I only have 90 minutes in my case so it's a constant battle to tweak what I can get to with my audience, so there's still lots of things I want to change.
But I think it's very important to have lots of resources here so I'm excited to look at yours.

petr251020181 reply#
Thanks.

You teach this in a classroom?

JulianWasTaken1 reply#
I do, it's given as a seminar twice a year.
petr25102018#
Nice! At least you get your feedback in real time, see what people struggle with and so on. That can be very useful.
catoc1 reply#
Interested, but going to the website told me nothing other than a book about the command line. Would be nice be able to get a preview of a some pages/chapters.
petr25102018#
Noted. For now I put links here, in the comments, and in the Gumroad page to sample pages. I will need to change the homepage later. Thanks for the input!
honkycat2 replies#
#1 thing in command line shell scripting should be: "Do not use it for advanced scripts. If you have multiple if statements and for loops, rewrite it in a higher level language."

This is also the advice given in the google shell guide.
I say this after years of being a DevOps and Platform engineer. Bash is trash. It is great for 10-20 line scripts. Beyond that, it is worthless.

petr251020181 reply#
I would not say it is trash, but I tend to agree with the general sentiment and personally don't write longer scripts.

> This is also the advice given in the google shell guide.
This advice is also given in this handbook :) But in reality you might come to a work repo that already has such scripts and it is good to understand it a little bit, I would think.

honkycat#
"I might come to work on..."

Friend, you have no idea LOL
My hatred is well earned!

brontosaurusrex1 reply#
Is there an explanation why? (Average line count in my scripts is 115).
honkycat#
Cryptic, overly complicated syntax. for loops, if statements, etc.. are all done better in other languages.

No package manager, build, or dependency features. This means it is ugly and gross to import functions from other programming languages.
Zero data structure support, so any data manipulation is horrible.
No test support, so you can't mock and test business logic.
No debugger support.
It's just a bad, cryptic, confusing language that is hard to maintain.
Remember: it's not that you CAN'T do these things, it's that they work better in other languages, like Node or Python. And shelling out in Python or node works great and is very easy. And Python comes built into most systems these days.
It is hard to justify writing shell scrips anymore. It's like writing perl or cobol. We have better tools now, the world has moved on.

Load more comments