Hands-on Lab·LPIC-1
The filters that process text streams
Objective 103.2 lists its commands by name and expects you to know what each one does. This guide runs them on one five-line file: selecting columns, ordering and counting, the small utilities, joining two files, and reshaping whitespace - with the two order dependencies that turn a correct-looking pipeline into a wrong answer.
101: GNU and Unix Commands Guide 26 of 33 Beginner
- OSUbuntu 26.04 LTS
- Kernel7.0.0-30-generic
- systemd259
- TimeAbout 24 min
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPIC1-A01 | 192.168.0.76 | Ubuntu 26.04 LTS | Debian-family host - dpkg and apt, which objective 102.4 names | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when you have a file and need an answer out of it without writing a script. This matters because two of these commands produce plausible wrong output when used alone: uniq only sees adjacent lines, and cut treats every single space as a delimiter.
- selecting columns by field and by character, and fixing the whitespace case with
tr -s - ordering by any field, numerically or textually, and counting with
sort | uniq -c - using
wc,nl,headandtail, including counting bytes and starting at a line - joining two files on a shared field, and pasting two files side by side
- reshaping with
expand,fmtandpr, and reading raw bytes withod
Before you start
- streams-pipes-and-redirection
-
The files this guide works on
-
Selecting columns, and where cut gives up
-
Ordering, and counting what is there
-
The small ones the objective names
-
Joining and reshaping
-
Whitespace, width and bytes
-
Putting the machine back