Where to begin
- ls lists a folder.
- cd, pwd and mkdir move you around and make folders, and explain paths.
- cp and mv copy, move and rename.
- cat, less, head and tail read text files.
- grep searches inside files.
- Pipes and redirection join commands together. This is the idea that makes the rest powerful.
- rm deletes, permanently. Read the whole page first.
Then, as you need them: find to locate files, sort, uniq, wc and cut for working with lines and columns, chmod, chown and sudo for permissions, ps, top and kill for running programs, df and du for disk space, tar and zip for archives, ping and curl for the network, echo, variables and PATH, and man, --help and history for getting help.
Things every command here shares
- Options start with a dash, as in
ls -l. Single letters can be joined:ls -la. - Capital and small letters matter:
File.txtandfile.txtare different on Linux. - Help is built in:
man command, orcommand --help. - Ctrl + C stops a running command.
- Tab completes names, and the up arrow recalls earlier commands.
- No news is good news. A command that succeeds often prints nothing.
Linux and the Mac
Both descend from Unix, which is why the same commands work on each. The differences are small: the Mac's versions of some tools accept slightly different options, home folders are under /Users on a Mac and /home on Linux, and software is installed with different tools. The pages mention these where they matter.
The same commands also work on Windows inside the Windows Subsystem for Linux, and many of them in Git Bash.
sudo
Some instructions put sudo in front of a command. It runs that one command with the administrator's powers, after asking for your password. Nearly everything on these pages needs no sudo. Treat any command that does as one to understand fully before running. The chmod page explains more.
This is an independent learning site. It is not connected with Microsoft, Apple or any Linux distribution. Windows, macOS and other names belong to their owners. Try commands first in a practice folder, never on files you cannot afford to lose.