// 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 directoryls -lahList all files with detailscd ~Go to your homecd ..Go up one levelfind . -name "*.txt"Find text files below hereman lsOpen a manual pageFiles and text
mkdir -p ~/practiceCreate a directorycp one.txt two.txtCopy a filemv old.txt new.txtMove or renamecat file.txtPrint a text fileless file.txtRead page by page (q exits)grep -in "word" file.txtSearch ignoring casetail -n 30 file.txtShow last 30 linesSystem checks
whoamiPrint your usernameuname -rShow kernel releasecat /etc/slackware-versionShow Slackware versiondf -hCheck disk spacefree -hView RAM usagelsblk -fShow drives and filesystemsdateShow date and timeidShow your user and groupsNetwork
ip -brief addressView interfaces and addressesip routeInspect routingping -c 3 1.1.1.1Test one remote hostgetent hosts example.orgCheck name resolutioncurl -I https://example.orgCheck HTTPS headers (if installed)ssh user@host.exampleConnect to a host you administerBash shortcuts
Ctrl+CStop the current foreground commandCtrl+LClear the visible terminalCtrl+RSearch command historyTabComplete a path or command↑ / ↓Browse command historysource ~/.bashrcReload interactive Bash settingsSlackware tools (root when required)
man slackpkgRead package-manager manualslackpkg search irssiSearch official package namesslackpkg 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 installedBitchXLaunch classic IRC client if installed; see the BitchX guideneomuttOpen terminal email client after setup; see the NeoMutt guidelinks https://example.orgStart a text browser if installednano file.txtEdit text if nano installedvi file.txtEdit text using vimuttStart terminal email if configuredSafe backup steps
rsync -avh --dry-run source/ backup/Preview changes; edit paths firstrsync -avh source/ backup/Copy; edit paths firstcp ~/.bashrc ~/.bashrc.backupBack up prompt configurationtmux: sessions & panes
tmux new -s darkpcStart a named tmux sessiontmux lsList sessionstmux attach -t darkpcReattach to a sessionCtrl+B, then DDetach; leave programs runningCtrl+B, then CCreate a new windowCtrl+B, then %Split into left and right panesWant context and explanation? Browse the complete tutorials →