Cheat Sheet
The commands you keep forgetting, with a one-line description and a real example you can copy - 629 across 38 tools. Pick a tool in the sidebar, or search across all of them.
awk
Process columns and compute over text - the one-liners people actually use.| Command | What it does | Example |
|---|---|---|
awk print column | Print a field (fields are 1-indexed). | awk '{print $2}' access.log |
awk -F | Set the field separator, e.g. for CSV. | awk -F, '{print $1}' users.csv |
awk $NF | Print the last field on each line. | awk '{print $NF}' access.log |
awk filter | Print rows where a column passes a test. | awk '$3 > 100' sales.txt |
awk /pattern/ | Print lines matching a regex. | awk '/ERROR/' app.log |
awk match + field | Combine a pattern with a column to print. | awk '/ERROR/ {print $1, $4}' app.log |
awk sum | Sum a column. | awk '{s += $1} END {print s}' nums.txt |
awk average | Average a column (NR = row count). | awk '{s += $1} END {print s/NR}' latencies.txt |
awk NR | Use the line number - print one line. | awk 'NR == 5' file.txt |
awk NR > 1 | Skip the header row. | awk 'NR > 1' report.csv |
awk count values | Count how often each value appears. | awk '{c[$1]++} END {for (k in c) print k, c[k]}' ips.txt |
awk dedupe | Drop duplicate lines without sorting first. | awk '!seen[$0]++' emails.txt |
awk with text | Mix fields with literal text. | awk '{print "id:", $1}' users.txt |
awk NF | NF = field count; find malformed rows. | awk 'NF != 4' data.tsv |
awk length() | Filter by line length. | awk 'length($0) > 80' main.py |
awk OFS | Change the output separator (CSV to TSV). | awk -F, 'BEGIN {OFS="\t"} {print $1, $3}' users.csv |