Menu
Linux · 03 Topic · 8 steps

GNU and Unix Commands

“The command line: filters, files, pipes and redirects, processes, regular expressions and vi.”

Topic 103 is the biggest part of LPIC-1 exam 101: 26 of its 60 points. It’s all about working in the shell with the classic GNU and Unix tools: running and combining commands, reshaping text with filters, managing files and archives, wiring commands together with pipes and redirects, controlling processes and their priorities, searching with regular expressions, and editing files in vi.

Everything later in LPIC-1 assumes these skills, so take your time here. Each byte follows one exam objective and ends with a checklist of what to remember.

You’ll learn:

  • how Bash runs commands, expands variables and finds programs in PATH
  • how to filter, sort, count and cut text with sort, uniq, cut, tr and friends
  • how to copy, find, archive and compress files with cp, find, tar, cpio, dd, gzip, bzip2 and xz
  • how to redirect output and errors, build pipelines and use tee and xargs
  • how to run jobs in the background, watch processes and send signals
  • how to change process priorities with nice and renice
  • how to write basic and extended regular expressions for grep and sed
  • how to edit any file in vi, and set your default editor

You’ll need: a Linux machine, a VM or a container. docker run -it --rm debian or docker run -it --rm ubuntu gives you a throwaway shell in seconds (install extras like vim, procps, bzip2, xz-utils or tmux with apt update && apt install ...). You’re root inside a container; on a normal system, a regular user is enough for almost everything here, and you only need sudo for setting negative nice values, reading other users’ files and writing to system paths like /etc.

Start reading →
Byte card for GNU and Unix Commands: Commands join with ; && ||. Exit status 0 means success, and export passes variables to children. Small filters do one job each: sort | uniq -c | sort -nr answers 'what's most common?' 0 stdin, 1 stdout, 2 stderr. > overwrites, >> appends, > file 2>&1 catches both. kill sends SIGTERM (15) first; SIGKILL (9) can't be caught. Nice runs from -20 to 19. grep -E and sed -E speak extended regex. In vi: i to type, Esc, then :wq or :q!

Byte card

The whole topic on one card

  1. Commands join with ; && ||. Exit status 0 means success, and export passes variables to children.
  2. Small filters do one job each: sort | uniq -c | sort -nr answers 'what's most common?'
  3. 0 stdin, 1 stdout, 2 stderr. > overwrites, >> appends, > file 2>&1 catches both.
  4. kill sends SIGTERM (15) first; SIGKILL (9) can't be caught. Nice runs from -20 to 19.
  5. grep -E and sed -E speak extended regex. In vi: i to type, Esc, then :wq or :q!

Save it as a cheat sheet, or share it with someone who's learning this too.

Search posts and bytes

Optional account

Keep your progress everywhere

Everything on AminBytes is free to read, with or without an account. Sign in only if you want your commits, streak and merged topics saved, on every device.

or

We keep only your name, avatar and which bytes you finished, and you can delete it all anytime. Privacy