// KEEP BY YOUR KEYBOARD

TERMINAL CHEAT SHEET.

One page of useful shell commands and shortcuts. Copy an example, change any placeholder paths or names, and read it before pressing Enter.

Heads up: the commands are for study. Examples that name files, remote hosts or backup targets need editing. Slackware package-management commands can alter the system and normally require root privileges.

Getting around

pwdShow the current directory
ls -lahList all files with details
cd ~Go to your home
cd ..Go up one level
find . -name "*.txt"Find text files below here
man lsOpen a manual page

Files and text

mkdir -p ~/practiceCreate a directory
cp one.txt two.txtCopy a file
mv old.txt new.txtMove or rename
cat file.txtPrint a text file
less file.txtRead page by page (q exits)
grep -in "word" file.txtSearch ignoring case
tail -n 30 file.txtShow last 30 lines

System checks

whoamiPrint your username
uname -rShow kernel release
cat /etc/slackware-versionShow Slackware version
df -hCheck disk space
free -hView RAM usage
lsblk -fShow drives and filesystems
dateShow date and time
idShow your user and groups

Network

ip -brief addressView interfaces and addresses
ip routeInspect routing
ping -c 3 1.1.1.1Test one remote host
getent hosts example.orgCheck name resolution
curl -I https://example.orgCheck HTTPS headers (if installed)
ssh user@host.exampleConnect to a host you administer

Bash shortcuts

Ctrl+CStop the current foreground command
Ctrl+LClear the visible terminal
Ctrl+RSearch command history
TabComplete a path or command
↑ / ↓Browse command history
source ~/.bashrcReload interactive Bash settings

Slackware tools (root when required)

man slackpkgRead package-manager manual
slackpkg search irssiSearch official package names
slackpkg updateRefresh package metadata (root)
slackpkg install-newFind newly added packages (root)
slackpkg upgrade-allUpgrade selected packages (root)
slackpkg new-configReview new config files (root)

Console programs

irssiLaunch IRC client if installed
BitchXLaunch classic IRC client if installed; see the BitchX guide
neomuttOpen terminal email client after setup; see the NeoMutt guide
links https://example.orgStart a text browser if installed
nano file.txtEdit text if nano installed
vi file.txtEdit text using vi
muttStart terminal email if configured

Safe backup steps

rsync -avh --dry-run source/ backup/Preview changes; edit paths first
rsync -avh source/ backup/Copy; edit paths first
cp ~/.bashrc ~/.bashrc.backupBack up prompt configuration

tmux: sessions & panes

tmux new -s darkpcStart a named tmux session
tmux lsList sessions
tmux attach -t darkpcReattach to a session
Ctrl+B, then DDetach; leave programs running
Ctrl+B, then CCreate a new window
Ctrl+B, then %Split into left and right panes

Want context and explanation? Browse the complete tutorials →