Linux & Docker commands, explained with a terminal you can try
The commands you will use every day, each with examples you can run right on the page. Free, nothing to install.
Files & folders
-
lsSee what is inside a folder: names, hidden files, sizes and permissions. -
cdMove between folders in the terminal: up a level, back home, back where you were. -
mkdirCreate one folder, several at once, or a whole path in one go with mkdir -p. -
touchCreate empty files from the terminal, several at once — and why touch never erases what is already inside. -
catPrint a file in the terminal, number its lines, or join several files into one output. -
cpMake a copy of a file, copy several files into a folder, or copy a whole folder with -r. -
mvRename a file or folder, or move it somewhere else. One command does both. -
rmDelete files, or whole folders with -r. There is no recycle bin: learn it safely here. -
findFind files by name or type, in a folder and every folder inside it. -
chmodWho can read, write and run a file: chmod in letters (u+x) and numbers (755), with a calculator. -
chownGive a file or a whole folder to another user and group with chown, and why it needs sudo.
Reading & editing text
-
grepFind the lines that contain a word, in one file, a whole folder or the output of another command. -
headSee the start of a file or of any command's output: the first 10 lines, or exactly as many as you want. -
tailRead the last lines of a log, skip a CSV header with tail -n +2, and watch a log live with tail -f. -
wcHow many lines in this file, how many errors in this log, how many files in this folder? wc -l answers. -
sedReplace a word in a file or in a pipe, every time it appears, or right inside the file with sed -i.
Processes
Shell & the web
Archives & backups
Docker
-
docker runCreate and start a container from an image, with ports, settings and volumes, explained flag by flag. -
docker psSee your containers: which are running, which stopped, their ports and names. -
docker imagesSee which images are on your machine, download one with docker pull, pick a version by its tag, and clean up with docker rmi. -
docker stopStop a running container, start it again with everything kept, or restart it after a config change. -
docker rmDelete stopped containers, force-remove a running one with -f, and let --rm clean up one-off containers for you. -
docker logsRead a container's output: why it crashed, who visited it, the last lines or live as it happens. -
docker volumeContainers are thrown away, data shouldn't be: create a volume, mount it with -v, and see it survive docker rm. -
docker networkPut containers on the same network so they reach each other by name — create, --network, connect and inspect. -
docker buildTurn a Dockerfile into an image you can run, with a name and a version tag. -
docker composeStart a whole app (web, database…) from one docker-compose.yml file with a single command.
Servers & admin
-
sshMake a key pair with ssh-keygen, install it with ssh-copy-id, then log in to the server with ssh — no password. -
systemctlIs the service running? Start it, restart it, make it start at boot — and read why it failed with journalctl. -
crontabRun a script every night at 2:00 or every 15 minutes: the crontab line explained, how to install it and check it ran. -
sudoOn a server you work as a normal user: sudo runs one command as root. Who may use it, sudo -u, and the > trap.