CLI Essentials Cheat Sheet: Bash, Git, Docker, kubectl, Vim, tmux

247 entries · 6 tools · static page, updated 2026-08-23

This page puts the six command-line tools most developers touch every day on one static page: the Bash shell and its readline keys, Git, Docker, kubectl, Vim and tmux. Every row is the same entry that appears on the individual reference page for that tool, so nothing here is a summary or an abridgement; it is the full table, concatenated, for people (and AI assistants) who want one fetch instead of six.

The tools are ordered roughly by how far down the stack they sit. Bash and Vim shortcuts are keystrokes that act immediately; Git, Docker and kubectl rows are commands you type and run; tmux mixes both, because its prefix key (Ctrl + b by default) turns ordinary letters into window and pane commands. If you only need one of these, the per-tool links in the table of contents go to the pages with category prose and source notes.

Bash / Shell — 52 entries, full reference

ShortcutActionNotes
ls -laDetailed listShow detailed file list including hidden files.
cd [path]Change directoryNavigate to the specified directory.
pwdCurrent pathPrint current working directory.
mkdir -p [path]Create directoryCreate directories including parents.
cp -r [src] [dst]CopyCopy files or directories.
mv [src] [dst]Move/RenameMove or rename files.
rm -rf [path]Force deleteForce delete files or directories.
find . -name [pattern]Find filesSearch for files by name pattern.
chmod +x [file]Make executableAdd execute permission to a file.
chown [user]:[group] [file]Change ownerChange file ownership.
cat [file]Print filePrint file contents.
grep [pattern] [file]Search textSearch for patterns in files.
head -n 20 [file]First N linesShow first 20 lines of a file.
tail -f [file]Follow fileFollow the end of a file in real time.
wc -l [file]Count linesCount lines in a file.
sort [file]SortSort file contents.
sed 's/old/new/g' [file]Find & replaceFind and replace text in files.
awk '{print $1}' [file]Extract fieldsExtract specific fields from files.
ps auxList processesShow all running processes.
topSystem monitorShow real-time system resource usage.
kill -9 [PID]Force killForce kill a process.
df -hDisk usageShow disk usage in human-readable format.
du -sh [path]Directory sizeShow total directory size.
free -hMemory usageShow memory usage.
curl [URL]HTTP requestSend an HTTP request to a URL.
ssh [user]@[host]SSH connectConnect to a remote server via SSH.
scp [file] [user]@[host]:[path]Remote copyCopy files remotely via SSH.
[cmd] | [cmd]PipePass output of one command as input to another.
[cmd] > [file]Redirect outputSave command output to file (overwrite).
[cmd] >> [file]Append outputAppend command output to file.
[cmd] 2>&1Redirect stderrMerge error output with standard output.
xargsPass argumentsConvert stdin to arguments for a command.
Ctrl + AStart of LineMoves the cursor to the beginning of the command line.
Ctrl + EEnd of LineMoves the cursor to the end of the line.
Ctrl + BBack One CharacterSame as Left arrow.
Ctrl + FForward One CharacterSame as Right arrow.
Alt + BBack One WordJumps the cursor back a word.
Alt + FForward One WordJumps the cursor forward a word.
Ctrl + WDelete Word Before CursorCuts the previous word into the kill ring.
Alt + DDelete Word After CursorCuts the next word.
Ctrl + UDelete to Line StartCuts everything before the cursor — fastest way to scrap a mistyped command.
Ctrl + KDelete to Line EndCuts everything after the cursor.
Ctrl + YYank (Paste)Pastes the most recently cut text back.
Ctrl + TTranspose CharactersSwaps the two characters around the cursor — fixes “sl” for “ls”.
Ctrl + LClear ScreenClears the terminal, keeping the current line.
Ctrl + _UndoUndoes the last editing change (also Ctrl + X, Ctrl + U).
Ctrl + RReverse SearchIncremental search backward through history — keep pressing to go further back.
Ctrl + SForward SearchSearches forward (needs `stty -ixon` in many terminals).
Ctrl + PPrevious CommandSame as Up arrow.
Ctrl + NNext CommandSame as Down arrow.
!!Repeat Last CommandClassic use: `sudo !!` after a permissions error.
!$Last ArgumentExpands to the final argument of the previous command.

Git — 24 entries, full reference

ShortcutActionNotes
git initInitialize repoInitialize a new Git repository.
git clone [URL]Clone repoClone a remote repository locally.
git statusCheck statusShow the status of changed files.
git add .Stage allStage all changed files.
git add [file]Stage fileStage a specific file.
git commit -m [msg]CommitCommit staged changes with a message.
git pushPushPush local commits to the remote repo.
git pullPullFetch and merge remote changes.
git fetchFetchFetch remote changes without merging.
git branchList branchesList local branches.
git branch [name]Create branchCreate a new branch.
git checkout [branch]Switch branchSwitch to another branch.
git checkout -b [name]Create & switchCreate and switch to a new branch.
git merge [branch]MergeMerge another branch into current.
git branch -d [name]Delete branchDelete a local branch.
git rebase [branch]RebaseRebase current branch onto another.
git logCommit historyShow commit history.
git log --onelineOne-line logShow commits in one-line format.
git diffShow diffShow unstaged changes.
git reset HEAD [file]UnstageUnstage a staged file.
git reset --hard HEAD~1Undo last commitCompletely undo the last commit.
git stashStash changesTemporarily save current changes.
git stash popApply stashRestore stashed changes.
git cherry-pick [hash]Cherry-pickApply a specific commit to current branch.

Docker — 24 entries, full reference

ShortcutActionNotes
docker run [image]Run containerCreate and start a new container.
docker psList runningList currently running containers.
docker ps -aList allList all containers including stopped.
docker stop [ID]Stop containerStop a running container.
docker rm [ID]Remove containerRemove a stopped container.
docker exec -it [ID] bashEnter containerOpen a bash shell inside a running container.
docker logs [ID]View logsView container logs.
docker restart [ID]RestartRestart a container.
docker imagesList imagesList locally stored images.
docker pull [image]Pull imageDownload an image from Docker Hub.
docker build -t [tag] .Build imageBuild an image from a Dockerfile.
docker rmi [image]Remove imageRemove a local image.
docker push [image]Push imagePush an image to a registry.
docker tag [src] [dst]Tag imageAssign a new tag to an image.
docker compose up -dStart servicesStart all services in the background.
docker compose downStop servicesStop and remove all service containers.
docker compose logs -fFollow logsFollow service logs in real time.
docker compose psService statusCheck service status.
docker compose buildBuild servicesBuild service images.
docker compose restartRestartRestart all services.
docker system pruneCleanupRemove unused containers, images, and networks.
docker volume lsList volumesList Docker volumes.
docker network lsList networksList Docker networks.
docker statsResource usageShow real-time CPU and memory usage per container.

Kubernetes (kubectl) — 17 entries, full reference

ShortcutActionNotes
kubectl get podsList podsList pods in current namespace.
kubectl get svcList servicesList services.
kubectl get nodesList nodesList cluster nodes.
kubectl get allAll resourcesList all resources.
kubectl describe pod [name]Pod detailsShow detailed pod information.
kubectl logs [pod]View logsView pod logs.
kubectl logs -f [pod]Follow logsFollow pod logs in real time.
kubectl apply -f [file]Apply resourceCreate/update resources from YAML.
kubectl delete pod [name]Delete podDelete a pod.
kubectl scale deploy [name] --replicas=3ScaleChange deployment replica count.
kubectl exec -it [pod] -- bashEnter podOpen bash shell inside a pod.
kubectl port-forward [pod] 8080:80Port forwardForward local port to pod port.
kubectl rollout restart deploy [name]Rolling restartRolling restart a deployment.
kubectl config get-contextsList contextsShow available contexts.
kubectl config use-context [name]Switch contextSwitch to another cluster context.
kubectl get nsList namespacesList namespaces.
kubectl -n [NS] get podsSpecify namespaceQuery resources in specific namespace.

Vim — 57 entries, full reference

ShortcutActionNotes
iInsert ModeEnter insert mode before cursor
aAppend ModeEnter insert mode after cursor
IInsert at Line StartInsert at beginning of line
AAppend at Line EndInsert at end of line
oOpen Line BelowOpen new line below and enter insert mode
OOpen Line AboveOpen new line above and enter insert mode
EscNormal ModeReturn to normal mode
vVisual ModeEnter visual mode
VVisual Line ModeEnter visual line mode
Ctrl + vVisual Block ModeEnter visual block mode
hLeftMove cursor left
jDownMove cursor down
kUpMove cursor up
lRightMove cursor right
wNext WordJump to start of next word
bPrevious WordJump to start of previous word
eEnd of WordJump to end of word
0Line StartMove to start of line
^First Non-blankMove to first non-blank character
$Line EndMove to end of line
ggFile StartGo to first line
GFile EndGo to last line
Ctrl + fPage DownScroll page down
Ctrl + bPage UpScroll page up
xDelete CharDelete character under cursor
ddDelete LineDelete current line
dwDelete WordDelete word
DDelete to EndDelete from cursor to end of line
yyYank LineCopy current line
ywYank WordCopy word
pPaste AfterPaste after cursor
PPaste BeforePaste before cursor
uUndoUndo last change
Ctrl + rRedoRedo change
rReplace CharReplace single character
RReplace ModeEnter replace mode
JJoin LinesJoin current line with next
/Search ForwardSearch forward
?Search BackwardSearch backward
nNext MatchGo to next search match
NPrevious MatchGo to previous search match
*Search WordSearch for word under cursor
#Search Word BackwardSearch word backward
:wSaveSave file
:qQuitQuit Vim
:wqSave & QuitSave and quit
:q!Force QuitQuit without saving
:e filenameEdit FileOpen file for editing
:spSplit HorizontalSplit window horizontally
:vspSplit VerticalSplit window vertically
.RepeatRepeat last command
~Toggle CaseToggle case of character
ci"Change in QuotesChange text inside quotes
di"Delete in QuotesDelete text inside quotes
qaRecord MacroRecord macro to register a
qStop RecordingStop recording macro
@aRun MacroExecute macro from register a

tmux — 73 entries, full reference

ShortcutActionNotes
Ctrl + B, DDetach clientDetach the current client, leaving the session running in the background.
Ctrl + B, $Rename sessionRename the current session.
Ctrl + B, SChoose sessionSelect a new session for the attached client interactively.
Ctrl + B, (Previous sessionSwitch the attached client to the previous session.
Ctrl + B, )Next sessionSwitch the attached client to the next session.
Ctrl + B, Shift + LLast sessionSwitch the attached client back to the last session (uppercase L).
Ctrl + B, Shift + DChoose client to detachChoose a client to detach (uppercase D).
Ctrl + B, Ctrl + ZSuspend clientSuspend the tmux client.
Ctrl + B, CNew windowCreate a new window.
Ctrl + B, &Kill windowKill the current window.
Ctrl + B, ,Rename windowRename the current window.
Ctrl + B, NNext windowChange to the next window.
Ctrl + B, PPrevious windowChange to the previous window.
Ctrl + B, LLast windowMove to the previously selected window (lowercase l).
Ctrl + B, 0-9Select window by numberSelect windows 0 to 9 directly.
Ctrl + B, 'Select window by indexPrompt for a window index to select.
Ctrl + B, WChoose windowChoose the current window interactively from a list.
Ctrl + B, .Move windowPrompt for an index to move the current window to.
Ctrl + B, FFind windowPrompt to search for text in open windows.
Ctrl + B, IWindow infoDisplay some information about the current window.
Ctrl + B, Alt + NNext window with activityMove to the next window with a bell or activity marker.
Ctrl + B, Alt + PPrevious window with activityMove to the previous window with a bell or activity marker.
Ctrl + B, %Split left and rightSplit the current pane into two, left and right.
Ctrl + B, "Split top and bottomSplit the current pane into two, top and bottom.
Ctrl + B, XKill paneKill the current pane.
Ctrl + B, ONext paneSelect the next pane in the current window.
Ctrl + B, ;Last paneMove to the previously active pane.
Ctrl + B, ↑/↓/←/→Select pane by directionChange to the pane above, below, to the left, or to the right of the current pane.
Ctrl + B, QShow pane numbersBriefly display pane indexes; press a number to jump to that pane.
Ctrl + B, ZZoom paneToggle zoom state of the current pane (fullscreen within the window).
Ctrl + B, {Swap with previous paneSwap the current pane with the previous pane.
Ctrl + B, }Swap with next paneSwap the current pane with the next pane.
Ctrl + B, Ctrl + ORotate panes forwardsRotate the panes in the current window forwards.
Ctrl + B, Alt + ORotate panes backwardsRotate the panes in the current window backwards.
Ctrl + B, !Break pane to windowBreak the current pane out of the window into its own window.
Ctrl + B, MMark paneMark the current pane, used as the default source for join and swap.
Ctrl + B, Shift + MClear marked paneClear the marked pane (uppercase M).
Ctrl + B, SpaceNext layoutArrange the current window in the next preset layout.
Ctrl + B, Alt + 1-7Preset layoutsArrange panes in one of the seven preset layouts: even-horizontal, even-vertical, main-horizontal, main-horizontal-mirrored, main-vertical, main-vertical-mirrored, or tiled.
Ctrl + B, Ctrl + ↑/↓/←/→Resize pane by one cellResize the current pane in steps of one cell.
Ctrl + B, Alt + ↑/↓/←/→Resize pane by five cellsResize the current pane in steps of five cells.
Ctrl + B, [Enter copy modeEnter copy mode to copy text or view the scrollback history.
Ctrl + B, ]Paste bufferPaste the most recently copied buffer of text.
Ctrl + B, Page UpCopy mode and scroll upEnter copy mode and scroll one page up.
Ctrl + B, #List paste buffersList all paste buffers.
Ctrl + B, =Choose buffer to pasteChoose which buffer to paste interactively from a list.
Ctrl + B, -Delete bufferDelete the most recently copied buffer of text.
QExit copy modeCancel and leave copy mode.
SpaceBegin selectionStart selecting text from the cursor position.
EnterCopy selection and exitCopy the current selection and exit copy mode.
VRectangle selectionToggle rectangle (block) selection mode.
Shift + VSelect lineSelect the current line (uppercase V).
/Search forwardSearch forward for the specified text.
?Search backwardSearch backwards for the specified text.
NRepeat searchRepeat the last search in the same direction.
Shift + NRepeat search reversedRepeat the last search in the reverse direction (uppercase N).
GTop of historyScroll to the top of the history.
Shift + GBottom of historyScroll to the bottom of the history (uppercase G).
Ctrl + UHalf page upScroll up by half a page.
Ctrl + DHalf page downScroll down by half a page.
Ctrl + BPage upScroll up by one page.
Ctrl + FPage downScroll down by one page.
0Start of lineMove the cursor to the start of the line.
$End of lineMove the cursor to the end of the line.
WNext wordMove to the next word.
BPrevious wordMove to the start of the previous word.
%Matching bracketMove to the next matching bracket.
Ctrl + B, :Command promptEnter the tmux command prompt to type commands directly.
Ctrl + B, ?List key bindingsList all key bindings.
Ctrl + B, TShow clockShow the time in the current pane.
Ctrl + B, RRedraw clientForce redraw of the attached client.
Ctrl + B, ~Show messagesShow previous messages from tmux, if any.
Ctrl + B, Ctrl + BSend prefixSend the prefix key through to the application running in the pane.

Rows on this page are identical to the per-tool reference pages; the per-tool pages carry source links and category notes. Other bundles: AI Coding Tools · Cloud & DevOps · Design Tools · Office & Productivity · AI Prompt Commands · all bundles.