Which terminal commands do data people actually need?
Move, inspect, slice, search, pipe, survive: the 24 commands that make a 2GB CSV feel small and a remote server feel like home, including the value-counts one-liner that needs no pandas.
Get the free PDF
One page, print-ready, free to share. No signup needed.
The server has no buttons to click. These 24 commands are the whole survival kit: move around, look at data, slice columns, search, pipe, and avoid the three classic accidents. The print-ready A4 PDF is at the bottom.
Move around
pwd: where am I.ls -lah: sizes + hidden files.cd -: back to the last directory.mkdir -p a/b: nested directories in one go.
Look at data
head -5 f.csv: first rows.tail -f app.log: follow a log live.wc -l f.csv: row count, any size, instantly.less f.csv: scroll without loading,qquits.
Slice and count
cut -d, -f1 f.csv: column 1.sort | uniq -c: value counts.awk -F, '{print $2}': column 2, with logic if needed.tr ',' '\t': swap delimiters.
Search
grep -r 'TODO' .: find in files.grep -c error app.log: count matches.find . -name '*.csv': find files.history | grep ssh: what did I run last time.
Pipes
a | b: output of a feeds input of b.> f.txt: write (overwrites!).>> f.txt: append.cmd1 && cmd2: run 2 only if 1 worked.
Survive
ctrl+c/ctrl+r: kill the command / search history.man cmd: the manual.chmod +x run.sh: make a script runnable.rm: no trash bin. Think first.
The one-liner worth stealing
Value counts of column 3, no pandas, any machine:
cut -d, -f3 sales.csv | sort | uniq -c | sort -rn | head
Take the column, group identical values, count each, biggest first, top 10. Works on a 10GB file over ssh.
The traps: the terminal forgives nothing
| You typed | What happens | The habit |
|---|---|---|
rm -rf $DIR/ | empty var = deletes everything | quote it, echo it first |
> data.csv | file wiped before you look | >> appends, > overwrites |
cat 10gb.csv | terminal drowns | head, less, wc -l instead |
There is no undo and no trash. The pros are not braver, they just echo before they run.
Frequently asked questions
How do I count the rows of a huge CSV without opening it?
How do I get value counts of a CSV column in the terminal?
What is the difference between > and >> in the shell?
Is rm recoverable?
Get the free PDF
One page, print-ready, free to share. No signup needed.