TUTORIAL 4 • BEGINNER → INTERMEDIATE

Process text with Linux commands

Linux becomes powerful when small commands are connected. A pipe sends one command's standard output into another command's standard input.

Start with one command

cat /etc/passwd
head -n 5 /etc/passwd
grep 'root' /etc/passwd

head limits output while grep selects lines matching a pattern. In LinuxTerminal, use the simulator's available files for practice.

Build a pipeline

cat file.txt | grep 'error' | sort | uniq

Read this from left to right: produce text, keep matching lines, sort them, then collapse adjacent duplicates. This “small tools” approach is central to shell work.

ToolTypical job
grepFilter lines by a pattern
sortOrder lines
uniqRemove adjacent duplicates or count them
cutSelect fields or character ranges
wcCount lines, words and bytes
Practice method: First run each command alone. Then add one pipe at a time and predict how the output changes.
Next tutorial → Linux permissions