Preview. This site isn’t public yet.

sudotutor

Cheat sheet

The commands from the practice terminal, grouped by what you’re trying to do. Print it; it fits on one page.

Where am I?

pwd
Print working directory: the full path of the folder you're in.
whoami
Prints the name of the user you're logged in as.
hostname
Prints the name of this computer.
id
Shows your user number, your main group, and every group you belong to.

Looking around

ls
Lists what's in the folder. Folders and files look the same here; try ls -l to tell them apart.
ls -a
-a shows hidden files too. Anything starting with a dot is hidden, and . and .. mean "this folder" and "the one above".
ls -l
-l is the long format: permissions, owner, size in bytes, date changed, name. A d at the start means it's a folder.
ls -la
Long format plus hidden files. This is the one most people type without thinking.
ls -lh
-h turns sizes into K and M instead of bytes. Folders still show 4.0K; that's the folder entry, not what's inside.
ls -R
-R goes into every folder below this one and lists each.

Reading files

cat notes.txt
cat prints a file's whole contents to the screen. Fine for short files.
head -n 2 notes.txt
head prints the first lines of a file. -n 2 means two lines.
tail -n 2 todo.txt
tail prints the last lines. People use tail -f to watch a log file grow.
wc -l notes.txt
wc counts. -l counts lines only.
grep buy todo.txt
grep prints the lines that contain your word.
grep -i LINUX notes.txt
-i ignores upper and lower case.
sort todo.txt
sort prints the lines in alphabetical order. The file itself doesn't change.

Moving and changing

cd docs
cd changes folder. cd .. goes up one, cd on its own goes home.
cd ..
Goes up one folder.
mkdir projects
Makes a folder. No output means it worked. Type ls to see it.
touch new.txt
Creates an empty file, or updates the date on one that exists. Type ls to see it.
cp notes.txt notes-copy.txt
Copies a file. The original stays. Type ls to see both.
mv todo.txt chores.txt
mv moves or renames. Here it renamed the file. Type ls.
rm todo.txt
Deleted. There's no trash can in a terminal; on a real machine that file is gone. Type ls to check.

Odds and ends

echo $HOME
$HOME is a variable that holds your home folder. echo shows its value.
du -sh photos
Disk usage. -s gives one total, -h makes it readable. Disk space is counted in 4K blocks, so it's bigger than the files.
find . -name "*.txt"
find searches this folder and everything under it. The quotes stop bash from expanding *.txt itself.
./hello.sh
./ means "the file right here". It runs because ls -l shows x (execute) in its permissions.

Output checked against GNU bash 5.2.37 and coreutils 9.7 on November 10, 2026.