chris@mochajava:~$ cd linux/ && cat toolkit.md

toolkit/

Part one was read-only on purpose — you could look around without breaking anything. This page hands you the tools that change things: copy, move, rename, delete. Same deal as before — open a terminal and type along. Just do it inside a sandbox, because one command on this page has no undo.

mkdir sandbox && cd sandbox

Now you're going to change things

Part one taught you to move and look. But Linux isn't a museum — it's a workshop. Every command on this page does something real to your files, and the honest truth up front: one of them can't be undone. So make yourself a sandbox first, and do your experimenting inside it. That's what it's for.

Everything below assumes you're standing inside your sandbox. If you get lost, pwd — that's the one you already know.

ls ~/working-toolkit

Six commands that build things

echo

print a line — your first act of writing

Echo prints back whatever you give it. Looks useless until you realize output doesn't have to go to the screen — it can go anywhere you point it. That's the finale of this page. For now, this is the shell's way of saying something.

echo hello, terminal hello, terminal

echo $HOME prints your home directory — it's how you peek at variables, not just words.

touch

make an empty file

mkdir makes a folder; touch makes a file. An empty one, nothing in it yet. Folders and files are how the tree is built, and now you're building.

touch notes.txt ls notes.txt

touch also updates a file's "last modified" date — hence the name, like reaching out and tapping it.

cp

copy a file

Two arguments: the thing you're copying, then where it's going. Keep a backup before you start changing something — it's cheap insurance, and it only takes a second.

cp notes.txt notes-backup.txt ls notes.txt notes-backup.txt

cp -r copies a whole directory, contents and all — r for recursive.

mv

move — and here's the trick, rename

Moves a file from one place to another. The surprise that trips every beginner: Linux has no separate "rename" command, because moving and renaming are the same thing — a file's name is just its address. Move it to a new name in the same folder, and you've renamed it.

mv notes.txt todo.txt ls notes-backup.txt todo.txt

mv is instant within the same filesystem — it changes the label, not the contents.

rm

remove — and there is no recycle bin

Deletes a file. Not "moves it to a trash folder" — deletes it. Gone. The command line doesn't second-guess you, and that's a feature: no shadow copies, no "are you sure?", just done. Which is exactly why you made a backup with cp two commands ago. Measure twice.

rm notes-backup.txt ls todo.txt

rm -rf is the one with the legends attached — remove a directory and everything inside it, f for "don't ask, just do it." It will happily eat your whole home directory if you point it wrong. Treat it with respect, and never type it tired or angry.

grep

search inside files — the finder

Searches text. Give it a word and a file and it prints every line that matches. This is the command you'll reach for more than any other once you have real files — logs, configs, code. First, let's put some text in our file:

echo remember: water the transplants > todo.txt grep water todo.txt remember: water the transplants

that > is redirection — it sends echo's output into a file instead of the screen. We'll get there properly at the bottom of this page.

cat pipelines.md

And now the one that matters most

Here's the other half of what makes Unix worth learning — and nobody tells beginners this part either: every command is small, and you can wire them together. The output of one command becomes the input of the next, using a pipe — that little vertical bar, |.

|

ls | grep notes — list everything, then keep only the lines that mention "notes". history | grep ssh — look through every command you've ever typed and pull out the ssh ones. cat file | head — dump a file, show only the top. You don't memorize a thousand commands; you learn a few small ones and compose them.

ls todo.txt ls | grep todo todo.txt

And its partner, redirection: > sends output to a file (overwriting what's there), >> appends to the end.

echo done > status.txt echo again >> status.txt cat status.txt done again

That's the real lesson of this page. Six verbs, a pipe, and a redirect, and you can build almost anything. The verbs get you working. The pipe makes you dangerous — in the good way.

And when you hit the wall — when the pipe won't flow or the flags don't make sense — you already have the answer from part one. man. The manual is still built in, and it still doesn't care what year it is.