Basic commands
31 articles, grouped by kind; the order follows the tracks.
Concepts 8
-
Getting help at the terminal
How to quickly find a command's options: man, --help, apropos and tldr; how to read a man page.
4 mincmd --helpman cmdman -
Bash scripts: running, variables, arguments
A script is a text file of shell commands: the #! line picks the interpreter, arguments arrive in $1, $2 and "$@".
9 minset -euochmodbash -
Exit codes: $?, && and ||
An exit code is a number from 0 to 255 that a command reports: 0 means success, anything else a failure or a "no".
10 minlsgrep -qmkdir -
How a command is built — options and arguments
A terminal line is a command name, options (-l, --all) and arguments; the shell splits it into words at spaces.
5 minls -lls -lals --all -
Glob patterns and brace expansion
Shell substitutions — * ? [] {} — and how they differ from regular expressions.
4 minmkdir -pcpecho -
Output redirection and pipelines
The shell sends a command's input and output to a file or another command — >, >>, 2>&1, /dev/null, the | pipe.
6 mincmdcmd1 -
Environment variables and PATH
Environment variables: env, export, $PATH, ~/.bashrc and profiles; where "command not found" comes from.
4 minechoenvprintenv -
Locale and encoding
Language, encoding and formats — LANG/LC_*, generating locales, UTF-8 problems.
4 minlocalelocale -alocale-gen
Commands 23
-
cd — changing directory
Moving around the filesystem: cd, cd -, cd ~, cd .., pushd/popd, CDPATH.
4 mincd dircdpushd dir -
mc — a terminal file manager4 min
A two-panel file manager for the terminal: navigation, copying, an editor, SFTP.
-
shellcheck — checking scripts before they run
shellcheck reads a bash or sh script without running it and finds bugs: unquoted variables, unchecked cd.
7 minshellcheckshellcheck -fshellcheck -S -
which / type / whereis — where a command lives
Find out which binary will run, whether it's a builtin or an alias, where it lives, and its man page.
4 mintype -acommand -vwhich cmd -
alias — command shortcuts
Short names for long commands; temporary and permanent via ~/.bashrc; why alias is invisible in scripts.
4 minaliasunalias llecho -
test, [ ] and [[ ]] — checking conditions7 min
test and [ ] check a file, a string or a number and answer with a code: 0 is yes, 1 is no; [[ ]] is the bash version.
-
echo — printing text
Printing strings and variables; -n and -e, escaping, when to prefer printf.
3 minechoecho -nprintf -
uptime, who, w — who is on the system and the load
Compare load average to the core count (nproc), not an absolute threshold — the three numbers mean nothing without it.
4 minuptimenprocw -
xargs — building arguments from a stream
Turns stdin lines into a command's arguments; without -0, file names with spaces and newlines break the parsing.
3 minfind -
printf and echo — printing text in scripts
Formatted output in the shell — more reliable than echo, formats and special characters.
4 minprintfprintf -v -
vim — editing files in the terminal
The bare minimum for editing configs; Esc always returns to Normal mode, where letters are commands, not text.
4 mini -
nano — a simple console editor
A friendly console editor — save, quit, search, for editing config files.
3 minnano filenanonano -w -
tmux — terminal multiplexer
Keeps a terminal session alive on the server after an SSH drop; sessions live in memory and don't survive a reboot.
4 mintmux newtmux lstmux attach -
screen — terminal multiplexer
Keeps a terminal session alive on the server after an SSH drop; sessions live in memory and don't survive a reboot.
4 minscreen -Sscreen -lsscreen -r -
watch — periodically repeat a command
Repeats a command every N seconds on one screen; without quotes, a pipeline goes to the shell, not the command.
3 minwatch -n1watch catwatch -
at — a one-time scheduled job
Run a command once at a given time — unlike cron's recurring schedule.
4 minechoat nowat -f -
flock — preventing a second run
flock holds a file lock while a command runs, so a second copy of the script waits for it or exits at once.
9 minflock -nflock -wflock -
date — date and time in the shell
The date command: current time, output formats, timestamps for files and logs, date arithmetic.
4 mindatedate -ddate -Iseconds -
bash — the command shell
A command interpreter for interactive input, builtins, and shell scripts.
5 minbash --versionhelptype pwd -
hostname — machine names and resolution
Reads or temporarily sets the host name; selected options report FQDNs and addresses.
4 minhostnamehostname -shostname -f -
pwd — the working directory
The Bash builtin prints the logical or physical path of the current directory.
3 minpwdpwd -Lpwd -P -
uname — kernel and system information
Reports kernel identity, node name, and machine architecture, not the distribution release.
3 minuname -suname -runame -v -
whoami — identify the effective user
whoami prints the user name tied to the process's effective user ID — the account you act as now.
3 minwhoamiid -uid -un
Nothing found. Try a shorter query.