Stop 01 · Programming & CS FoundationsTopics · 10/12

Command Line Basics

Part of the AI Engineer Roadmap

In short

Training jobs run on remote servers with no mouse and no desktop. The terminal is how you move around, run scripts, read logs and check if your GPU is busy.

Navigating directories, running scripts, managing processes and reading logs from the terminal — unavoidable once you move past notebooks into real pipelines.

The purple blob sits in an auto-rickshaw and points the way while the driver steers.

Think of it like this

Giving directions to an auto driver

You don't show the driver a picture of your destination. You say: straight, left at the temple, stop at the second gate. Short, exact instructions, one at a time. The terminal works like that. You type cd, ls, python, and the computer does exactly that, nothing more.

Watch it happen

Moving around with cd

~ (home)
Downloads
projects
ai-notes
data/
train.py

1/5A new terminal starts in your home folder, shown as ~. pwd prints where you are.

The big ideas

What you need to know

Know where you are

pwd shows the current folder, ls shows what's in it, cd moves you. Most 'file not found' errors are just being in the wrong folder.

Peek at files without opening them

head -n 5 data.csv shows the first rows. wc -l counts lines. Great for checking a huge file in a second.

grep finds text

grep "ERROR" train.log shows only the error lines from a long log file.

Watch what's running

top or htop shows CPU and memory use. On an NVIDIA GPU machine, nvidia-smi shows GPU memory and usage.

See it in code

Walk through the code

bash
1pwd                         # where am I?2ls -la                      # list files, including hidden ones3cd ~/projects/ai-notes      # go to a folder4mkdir -p data/raw           # make nested folders5 6head -n 5 data/raw/sales.csv   # first 5 lines7wc -l data/raw/sales.csv       # how many lines8 9python train.py > train.log 2>&1 &   # run in background, log output10tail -f train.log                    # watch the log live (Ctrl+C to stop)11grep -i "error" train.log            # find problems

1/3Find yourself, look around, move, and create folders. -p makes parent folders too.

These commands work the same on macOS, Linux and in WSL on Windows. They're also what you'll use on any cloud GPU machine.

Save yourself the pain

Common mistakes

Oops

Running rm -rf on a path you typed in a hurry.

Do this instead

Run ls on the exact path first. There's no recycle bin in the terminal.

Oops

Closing the terminal and expecting a long training job to keep running.

Do this instead

Use nohup, tmux or screen so the job survives when you disconnect.

Your mission

Explore a dataset from the terminal

~15 min

Quick check

You run python train.py and get 'No such file or directory', but you can see train.py in Finder. What should you check first?

Go deeper

  1. 1Practice core commands: `cd`, `ls`, `cp`, `mv`, `grep`, `cat`, `chmod`.
  2. 2Learn to run and background long-running Python scripts from the terminal.
  3. 3Get comfortable reading stack traces and error output in the shell.

More topics at this stop

Stuck on this topic? Ask an Insider

Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.

Download
InsideEdge