Writing /
The 10% of the terminal that solves 90% of the job
The four terminal skills you will use the most: moving around without a GUI, SSH with an alias for you and your coding agent, tmux, and watching the CPU and the GPU.
Servers, deployments, remote GPUs, agents like Claude Code or Codex: it all happens in the terminal. This tutorial gives you the four skills you will use the most, until you can do them from memory:
- Move around a machine without a GUI:
pwd,ls,cd,nano. - Get into another machine and move files:
ssh,scp. - Keep jobs running after you disconnect:
tmux. - See what is going on:
top,nvidia-smi.
We’ll follow one night on call. It is 2:47 and an alert comes in: the overnight Whisper training run on the gpu server has died with CUDA out of memory. Each section is one step of the fix and ends with a 30-second challenge. At the end there is a PDF cheat sheet with every command.
1. Moving around without a GUI
First, on your laptop: lower the batch_size in the config before launching again.
pwd # where am I?
ls # what is here?
cd projects/whisper # go in, relative to where you are
cd configs # and one level further
nano train.yaml # edit: Ctrl-O and Enter save, Ctrl-X exits
cd .. # up one level: back in whisper
pwd gives the path from the root (the thick line), ls lights up what is inside and cd moves the marker. nano edits without leaving the terminal.- Every path that does not start with
/or~is relative to the folder you are in. If a command cannot find a file, the first thing to run ispwd. ~is your home folder (/home/username) and/is the root of everything.cd ~takes you home from wherever you are.- Tab completes names:
cd proand Tab. It is the shortcut that saves the most time.
Windows: in PowerShell, pwd, ls and cd work the same. notepad train.yaml opens the file in Notepad, in a window; to edit inside the terminal, use nano in WSL.
30-second challenge. From ~, go into a project, list what is there, change one line of a file with nano, save and go back to ~. No mouse.
2. Getting into other machines (you and your agent)
The config is fixed, but the training lives on gpu. You have to get there and take it with you. This part you set up once:
ssh-keygen -t ed25519 # creates your key pair; give it a passphrase
ssh-copy-id username@10.0.3.7 # leaves the public key on the server
nano ~/.ssh/config # and gives it a short name
Host gpu
HostName 10.0.3.7
User username
And this is the everyday part:
ssh gpu # get in
scp configs/train.yaml gpu:~/whisper/configs/ # send a file
scp gpu:~/whisper/logs/train.log . # bring one back
exit # get out
- The first time you connect, SSH shows the server’s fingerprint and asks
yes/no. Answeryesonly if it matches the one you get from whoever runs the machine. scp source destination, always in that order. The remote side hasgpu:in front.- If you have to go through another machine to get there, add
ProxyJump bastionto theHostblock.
Your agent uses the same alias
Claude Code and Codex run commands in your terminal, so they inherit your ~/.ssh/config. You can ask them “check with ssh gpu nvidia-smi how much memory is free” and they will, usually after asking for permission. Keep in mind that they log in as you:
- Whatever your user can do on
gpu, the agent can too. If you want it to be able to do less, give it its ownHost gpu-agentblock, with a user withoutsudoand its own key. - It can use any key in your
~/.ssh, not just the one forgpu. Keep production keys off the machine the agent works on. - Keep manual approval for
ssh,scpandrsync, and never pick “always allow” forssh gpu: anything can follow the host name.
Windows: OpenSSH ships with Windows 10 and 11, and ssh, scp and ssh-keygen work in PowerShell. The config lives in C:\Users<you>.ssh\config. ssh-copy-id does not exist; instead: type $env:USERPROFILE.ssh\id_ed25519.pub | ssh username@10.0.3.7 “mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >> ~/.ssh/authorized_keys”.
30-second challenge. Create an alias for a machine you log into often, get in with ssh <alias>, get out and bring a file back with scp.
3. Keeping jobs running: tmux
You are on gpu with the new config. If you just launch the training again and the VPN drops, it dies with you.
tmux new -s train # opens a named session
python train.py # launch whatever you need
Ctrl-b d # you leave; it keeps running
tmux ls # list sessions
tmux attach -t train # you come back
SIGHUP and ends. Inside tmux it hangs from the tmux server, which lives on the machine, so you can leave, close the laptop and come back.Ctrl-bis the prefix: press it, let go, then press the other key.- If you want more:
Ctrl-b %splits the screen into two panes andCtrl-bplus an arrow moves you between them.
A session for your agent
tmux new -s claude
claude # or codex
Give it the task (“why did the 2:41 run fail?”), leave with Ctrl-b d and come back whenever you like. If it needs permission for something, it will be waiting for you there. Note that, launched on the server, your agent’s credentials stay on it. Do it only on machines you trust, and without options that skip approvals.
Windows: tmux does not exist on Windows. Use it inside WSL or, better, on the Linux server you reach over SSH, which is where it matters.
30-second challenge. Create a session, run sleep 300, leave, check with tmux ls that it is still alive and go back in.
4. Seeing what is going on: top and nvidia-smi
The training is running. But why did it run out of memory with batch 32?
top # CPU and memory per process; q to quit
nvidia-smi # GPU: memory, utilization and who holds it
watch -n 1 nvidia-smi # the same, every second
ps -o user=,args= -p 2290 # whose is it, and what is it?
kill 2290 # ends a process by its PID
top sorts by CPU, and a process that only uses the GPU barely shows. nvidia-smi shows which PIDs hold the memory, even if both are called python3; ps tells you 2290 is a Jupyter kernel forgotten in the afternoon, with 9 GB. With it there, batch 32 did not fit. Illustrative figures.- Before
kill, check whose process it is withps. If it is not yours, ask before touching it. htop, if it is installed, istopwith colours and easier to read.
Windows: Task Manager is your top; in PowerShell, Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 lists the processes that have used the most CPU time. nvidia-smi comes with the NVIDIA driver and works the same.
30-second challenge. In a tmux session, open watch -n 1 nvidia-smi in one pane while you train in the other.
3:20
Training relaunched, GPU free and the agent going through the log. Time for bed.
Download the PDF cheat sheet: one page with the commands of the four sections, to keep at hand or print.
Practise in the lab: a Google Colab notebook with a real SSH server and a hidden flag in each section.
To keep going: tldr pages gives the most common use of each command, explainshell takes apart any line you come across, MIT’s The Missing Semester covers everything a degree takes for granted, and Julia Evans’s zines explain it with drawings.