Linux & shell: Text processing pipelines
4 Linux & shell commands: Text processing pipelines. Click a command to see what each part does.
Linux & shell: Text processing pipelinesIndex
- Whole sheet251
- Navigate & list13
- Create, copy, move, delete13
- View & compare files9
- Permissions & ownership31
- Help & shell basics11
- Users & groups6
- Install packages7
- Package & software versions29
- System info9
- Network basics & SSH10
- Zip & compress4
- Shell operators6
- Processes6
- Files & search8
- Text processing pipelines4
- Disk3
- Network5
- Services & logs6
- Archives & copying4
- Firewall7
- Scheduling: cron & systemd timers6
- Storage, mounts & LVM10
- Kernel, hardware & limits8
- Performance & tracing10
- TLS & certificates8
- Packet capture & network debugging10
- Terminal tools8
Text processing pipelines4
sort <file> | uniq -c | sort -rn | headCount duplicate lines, most frequent firstWhat each part does
sort <file>sort lines so duplicates sit next to each otheruniq -ccollapse adjacent duplicates and prefix each with its countsort -rnsort by that number (-n numeric) in reverse order (-r)headtop 10
awk '{print $1}' access.log | sort | uniq -c | sort -rn | headTop client IPs in an access logWhat each part does
awk '{print $1}'print the first whitespace-separated field of every line (the client IP)sort | uniq -cgroup identical IPs and count themsort -rn | headhighest counts first, top 10
grep -c "<pattern>" <file>; wc -l <file>Count lines / matchesWhat each part does
grep -ccount matching lines instead of printing themwc -lcount all lines in the file
sort -t: -k3,3n /etc/passwdSort a delimited file by a numeric columnWhat each part does
-t:fields are separated by ":"-k3,3sort key is field 3 onlyncompare that key as a number
Nothing matches.
My DevOps Playbook by Angelo John Calleja