iverse.deviverse.dev

The terminal, and the commands that matter

Jem Young4 min

tl;dr

The terminal is a window; the shell is what actually talks to the operating system. Ten commands cover most of the work, one has no undo, and `man` is how you look up the rest.

The terminal is not the shell

The terminal is an application — a window that draws text. iTerm2, Terminal.app: interchangeable, pick one.

The shell is what runs inside it. It reads what you typed and asks the operating system to do it. That one is a decision.

Five stacked layers: you, terminal, shell, operating system, hardware. The shell is highlighted.
The terminal is the window. The shell is the layer that actually asks for anything.

Why it's worth learning

The consistency is the real argument: everything else in this course happens on a machine you cannot click around on.

The commands

lslist directory contentsls -la is the one worth muscle memory
cdchange directorycd .. up, cd ~ home
mkdirmake a directorymkdir -p a/b/c builds the whole chain
rmdirremove a directoryrefuses if it isn't empty
catshow file contentsfine for short files
lessshow file contents by pagewhat you want for long ones
touchcreate an empty filenot really — see below
rmremove a filerm -rf is recursive and silent
echorepeat inputessential inside scripts
manthe manual for a commandawkward to read, and it works offline
One row of ls -la output with each segment labelled: permissions, links, owner, group, size, modified date, filename.
Without -a your .gitignore is invisible and you will swear it was there.

The exercise

cd ~            # home
mkdir temp
cd temp
ls              # empty
touch hello
ls              # hello
cd ..
rm -rf temp
Three snapshots of the home directory: empty, then holding temp and hello, then empty again.
Watch the CWD marker. Where you are changes what every following command means.

hello has no extension and no type — it is a blob of bytes with a name. That is the whole story of a file here.

When you get lost

Three gotchas

On Windows, install WSL — same commands, forward slashes instead of back.

← all Full Stack Fundamentals, v3 posts