← All cheatsheets
Data Engineer · #035 · August 27, 2026 · 2 min read

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.

Download the PDF

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, q quits.

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 typedWhat happensThe habit
rm -rf $DIR/empty var = deletes everythingquote it, echo it first
> data.csvfile wiped before you look>> appends, > overwrites
cat 10gb.csvterminal drownshead, 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?
wc -l file.csv. It streams the file, so it works instantly on files your laptop cannot open in Excel or pandas, over ssh, with nothing installed. Pair it with head -5 file.csv to see the first rows.
How do I get value counts of a CSV column in the terminal?
cut -d, -f3 file.csv | sort | uniq -c | sort -rn | head. Take column 3, group identical values, count each, sort by count, show the top 10. It is the terminal version of pandas value_counts and it works on any machine.
What is the difference between > and >> in the shell?
One character, one destroyed file: > writes and OVERWRITES the target, >> appends to it. If a file matters, check what you typed before pressing enter, because the overwrite happens before the command even runs.
Is rm recoverable?
No. rm does not use a trash bin, the file is gone. The classic accident is rm -rf $DIR/ where the variable is empty or wrong. The habit that prevents it: echo the command first to see what it expands to, and quote your variables.

Get the free PDF

One page, print-ready, free to share. No signup needed.

Download the PDF

More cheatsheets