Linux & shell: Help & shell basics
11 Linux & shell commands: Help & shell basics. Click a command to see what each part does.
Linux & shell: Help & shell basicsIndex
- Whole sheet251
- Navigate & list13
- Create, copy, move, delete13
- View & compare files9
- Permissions & ownership31
- Help & shell basics11
- Users & groups6
- Install packages7
- Package & software versions29
- System info9
- Network basics & SSH10
- Zip & compress4
- Shell operators6
- Processes6
- Files & search8
- Text processing pipelines4
- Disk3
- Network5
- Services & logs6
- Archives & copying4
- Firewall7
- Scheduling: cron & systemd timers6
- Storage, mounts & LVM10
- Kernel, hardware & limits8
- Performance & tracing10
- TLS & certificates8
- Packet capture & network debugging10
- Terminal tools8
Help & shell basics11
man <command>Read the manual for a commandWhat each part does
manmanual page; / to search, q to quit<command>e.g. man ls, man tar
<command> --helpQuick help for a commandWhat each part does
--helpmost tools print their options and exit
which <command>; type <command>Where is a command installed?What each part does
whichpath of the program that would runtypealso tells you if it is an alias, built-in or function
history | grep <word>Search your command historyWhat each part does
historynumbered list of commands you ran| grep <word>only the ones containing <word>; re-run one with !<number>
Tip Faster: press Ctrl+R and start typing to search history interactively.
sudo !!Re-run the last command with sudoWhat each part does
sudorun as root!!history expansion: the whole previous command
alias ll='ls -lh'Create a shortcut commandWhat each part does
aliasdefine a short name for a commandll='ls -lh'typing ll now runs ls -lh (add it to ~/.bashrc to keep it)
echo "$HOME"Print a variableWhat each part does
echoprint text"$HOME"value of the HOME variable; quotes keep spaces intact
export <NAME>=<value>Set a variable for this shell and its programsWhat each part does
exportmake the variable visible to programs you start from this shell<NAME>=<value>no spaces around =
env | grep <NAME>Show environment variablesWhat each part does
envall environment variables| grep <NAME>only matching ones
sudo <command>; sudo -iRun as root / open a root shellCautionWhat each part does
sudo <command>run one command as root (asks for your password)sudo -iinteractive root login shell; type exit to leave
Tab · Ctrl+C · Ctrl+R · Ctrl+L · Ctrl+DUseful keysWhat each part does
Tabcomplete file and command names (press twice to list options)Ctrl+Cstop the running commandCtrl+Rsearch command historyCtrl+Lclear the screen (same as clear)Ctrl+Dend input / log out of the shell
Nothing matches.
My DevOps Playbook by Angelo John Calleja