CLI Essentials Cheat Sheet: Bash, Git, Docker, kubectl, Vim, tmux
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)
- Git (24)
- Docker (24)
- Kubernetes (kubectl) (17)
- Vim (57)
- tmux (73)
Bash / Shell — 52 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| ls -la | Detailed list | Show detailed file list including hidden files. |
| cd [path] | Change directory | Navigate to the specified directory. |
| pwd | Current path | Print current working directory. |
| mkdir -p [path] | Create directory | Create directories including parents. |
| cp -r [src] [dst] | Copy | Copy files or directories. |
| mv [src] [dst] | Move/Rename | Move or rename files. |
| rm -rf [path] | Force delete | Force delete files or directories. |
| find . -name [pattern] | Find files | Search for files by name pattern. |
| chmod +x [file] | Make executable | Add execute permission to a file. |
| chown [user]:[group] [file] | Change owner | Change file ownership. |
| cat [file] | Print file | Print file contents. |
| grep [pattern] [file] | Search text | Search for patterns in files. |
| head -n 20 [file] | First N lines | Show first 20 lines of a file. |
| tail -f [file] | Follow file | Follow the end of a file in real time. |
| wc -l [file] | Count lines | Count lines in a file. |
| sort [file] | Sort | Sort file contents. |
| sed 's/old/new/g' [file] | Find & replace | Find and replace text in files. |
| awk '{print $1}' [file] | Extract fields | Extract specific fields from files. |
| ps aux | List processes | Show all running processes. |
| top | System monitor | Show real-time system resource usage. |
| kill -9 [PID] | Force kill | Force kill a process. |
| df -h | Disk usage | Show disk usage in human-readable format. |
| du -sh [path] | Directory size | Show total directory size. |
| free -h | Memory usage | Show memory usage. |
| curl [URL] | HTTP request | Send an HTTP request to a URL. |
| ssh [user]@[host] | SSH connect | Connect to a remote server via SSH. |
| scp [file] [user]@[host]:[path] | Remote copy | Copy files remotely via SSH. |
| [cmd] | [cmd] | Pipe | Pass output of one command as input to another. |
| [cmd] > [file] | Redirect output | Save command output to file (overwrite). |
| [cmd] >> [file] | Append output | Append command output to file. |
| [cmd] 2>&1 | Redirect stderr | Merge error output with standard output. |
| xargs | Pass arguments | Convert stdin to arguments for a command. |
| Ctrl + A | Start of Line | Moves the cursor to the beginning of the command line. |
| Ctrl + E | End of Line | Moves the cursor to the end of the line. |
| Ctrl + B | Back One Character | Same as Left arrow. |
| Ctrl + F | Forward One Character | Same as Right arrow. |
| Alt + B | Back One Word | Jumps the cursor back a word. |
| Alt + F | Forward One Word | Jumps the cursor forward a word. |
| Ctrl + W | Delete Word Before Cursor | Cuts the previous word into the kill ring. |
| Alt + D | Delete Word After Cursor | Cuts the next word. |
| Ctrl + U | Delete to Line Start | Cuts everything before the cursor — fastest way to scrap a mistyped command. |
| Ctrl + K | Delete to Line End | Cuts everything after the cursor. |
| Ctrl + Y | Yank (Paste) | Pastes the most recently cut text back. |
| Ctrl + T | Transpose Characters | Swaps the two characters around the cursor — fixes “sl” for “ls”. |
| Ctrl + L | Clear Screen | Clears the terminal, keeping the current line. |
| Ctrl + _ | Undo | Undoes the last editing change (also Ctrl + X, Ctrl + U). |
| Ctrl + R | Reverse Search | Incremental search backward through history — keep pressing to go further back. |
| Ctrl + S | Forward Search | Searches forward (needs `stty -ixon` in many terminals). |
| Ctrl + P | Previous Command | Same as Up arrow. |
| Ctrl + N | Next Command | Same as Down arrow. |
| !! | Repeat Last Command | Classic use: `sudo !!` after a permissions error. |
| !$ | Last Argument | Expands to the final argument of the previous command. |
Git — 24 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| git init | Initialize repo | Initialize a new Git repository. |
| git clone [URL] | Clone repo | Clone a remote repository locally. |
| git status | Check status | Show the status of changed files. |
| git add . | Stage all | Stage all changed files. |
| git add [file] | Stage file | Stage a specific file. |
| git commit -m [msg] | Commit | Commit staged changes with a message. |
| git push | Push | Push local commits to the remote repo. |
| git pull | Pull | Fetch and merge remote changes. |
| git fetch | Fetch | Fetch remote changes without merging. |
| git branch | List branches | List local branches. |
| git branch [name] | Create branch | Create a new branch. |
| git checkout [branch] | Switch branch | Switch to another branch. |
| git checkout -b [name] | Create & switch | Create and switch to a new branch. |
| git merge [branch] | Merge | Merge another branch into current. |
| git branch -d [name] | Delete branch | Delete a local branch. |
| git rebase [branch] | Rebase | Rebase current branch onto another. |
| git log | Commit history | Show commit history. |
| git log --oneline | One-line log | Show commits in one-line format. |
| git diff | Show diff | Show unstaged changes. |
| git reset HEAD [file] | Unstage | Unstage a staged file. |
| git reset --hard HEAD~1 | Undo last commit | Completely undo the last commit. |
| git stash | Stash changes | Temporarily save current changes. |
| git stash pop | Apply stash | Restore stashed changes. |
| git cherry-pick [hash] | Cherry-pick | Apply a specific commit to current branch. |
Docker — 24 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| docker run [image] | Run container | Create and start a new container. |
| docker ps | List running | List currently running containers. |
| docker ps -a | List all | List all containers including stopped. |
| docker stop [ID] | Stop container | Stop a running container. |
| docker rm [ID] | Remove container | Remove a stopped container. |
| docker exec -it [ID] bash | Enter container | Open a bash shell inside a running container. |
| docker logs [ID] | View logs | View container logs. |
| docker restart [ID] | Restart | Restart a container. |
| docker images | List images | List locally stored images. |
| docker pull [image] | Pull image | Download an image from Docker Hub. |
| docker build -t [tag] . | Build image | Build an image from a Dockerfile. |
| docker rmi [image] | Remove image | Remove a local image. |
| docker push [image] | Push image | Push an image to a registry. |
| docker tag [src] [dst] | Tag image | Assign a new tag to an image. |
| docker compose up -d | Start services | Start all services in the background. |
| docker compose down | Stop services | Stop and remove all service containers. |
| docker compose logs -f | Follow logs | Follow service logs in real time. |
| docker compose ps | Service status | Check service status. |
| docker compose build | Build services | Build service images. |
| docker compose restart | Restart | Restart all services. |
| docker system prune | Cleanup | Remove unused containers, images, and networks. |
| docker volume ls | List volumes | List Docker volumes. |
| docker network ls | List networks | List Docker networks. |
| docker stats | Resource usage | Show real-time CPU and memory usage per container. |
Kubernetes (kubectl) — 17 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| kubectl get pods | List pods | List pods in current namespace. |
| kubectl get svc | List services | List services. |
| kubectl get nodes | List nodes | List cluster nodes. |
| kubectl get all | All resources | List all resources. |
| kubectl describe pod [name] | Pod details | Show detailed pod information. |
| kubectl logs [pod] | View logs | View pod logs. |
| kubectl logs -f [pod] | Follow logs | Follow pod logs in real time. |
| kubectl apply -f [file] | Apply resource | Create/update resources from YAML. |
| kubectl delete pod [name] | Delete pod | Delete a pod. |
| kubectl scale deploy [name] --replicas=3 | Scale | Change deployment replica count. |
| kubectl exec -it [pod] -- bash | Enter pod | Open bash shell inside a pod. |
| kubectl port-forward [pod] 8080:80 | Port forward | Forward local port to pod port. |
| kubectl rollout restart deploy [name] | Rolling restart | Rolling restart a deployment. |
| kubectl config get-contexts | List contexts | Show available contexts. |
| kubectl config use-context [name] | Switch context | Switch to another cluster context. |
| kubectl get ns | List namespaces | List namespaces. |
| kubectl -n [NS] get pods | Specify namespace | Query resources in specific namespace. |
Vim — 57 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| i | Insert Mode | Enter insert mode before cursor |
| a | Append Mode | Enter insert mode after cursor |
| I | Insert at Line Start | Insert at beginning of line |
| A | Append at Line End | Insert at end of line |
| o | Open Line Below | Open new line below and enter insert mode |
| O | Open Line Above | Open new line above and enter insert mode |
| Esc | Normal Mode | Return to normal mode |
| v | Visual Mode | Enter visual mode |
| V | Visual Line Mode | Enter visual line mode |
| Ctrl + v | Visual Block Mode | Enter visual block mode |
| h | Left | Move cursor left |
| j | Down | Move cursor down |
| k | Up | Move cursor up |
| l | Right | Move cursor right |
| w | Next Word | Jump to start of next word |
| b | Previous Word | Jump to start of previous word |
| e | End of Word | Jump to end of word |
| 0 | Line Start | Move to start of line |
| ^ | First Non-blank | Move to first non-blank character |
| $ | Line End | Move to end of line |
| gg | File Start | Go to first line |
| G | File End | Go to last line |
| Ctrl + f | Page Down | Scroll page down |
| Ctrl + b | Page Up | Scroll page up |
| x | Delete Char | Delete character under cursor |
| dd | Delete Line | Delete current line |
| dw | Delete Word | Delete word |
| D | Delete to End | Delete from cursor to end of line |
| yy | Yank Line | Copy current line |
| yw | Yank Word | Copy word |
| p | Paste After | Paste after cursor |
| P | Paste Before | Paste before cursor |
| u | Undo | Undo last change |
| Ctrl + r | Redo | Redo change |
| r | Replace Char | Replace single character |
| R | Replace Mode | Enter replace mode |
| J | Join Lines | Join current line with next |
| / | Search Forward | Search forward |
| ? | Search Backward | Search backward |
| n | Next Match | Go to next search match |
| N | Previous Match | Go to previous search match |
| * | Search Word | Search for word under cursor |
| # | Search Word Backward | Search word backward |
| :w | Save | Save file |
| :q | Quit | Quit Vim |
| :wq | Save & Quit | Save and quit |
| :q! | Force Quit | Quit without saving |
| :e filename | Edit File | Open file for editing |
| :sp | Split Horizontal | Split window horizontally |
| :vsp | Split Vertical | Split window vertically |
| . | Repeat | Repeat last command |
| ~ | Toggle Case | Toggle case of character |
| ci" | Change in Quotes | Change text inside quotes |
| di" | Delete in Quotes | Delete text inside quotes |
| qa | Record Macro | Record macro to register a |
| q | Stop Recording | Stop recording macro |
| @a | Run Macro | Execute macro from register a |
tmux — 73 entries, full reference
| Shortcut | Action | Notes |
|---|---|---|
| Ctrl + B, D | Detach client | Detach the current client, leaving the session running in the background. |
| Ctrl + B, $ | Rename session | Rename the current session. |
| Ctrl + B, S | Choose session | Select a new session for the attached client interactively. |
| Ctrl + B, ( | Previous session | Switch the attached client to the previous session. |
| Ctrl + B, ) | Next session | Switch the attached client to the next session. |
| Ctrl + B, Shift + L | Last session | Switch the attached client back to the last session (uppercase L). |
| Ctrl + B, Shift + D | Choose client to detach | Choose a client to detach (uppercase D). |
| Ctrl + B, Ctrl + Z | Suspend client | Suspend the tmux client. |
| Ctrl + B, C | New window | Create a new window. |
| Ctrl + B, & | Kill window | Kill the current window. |
| Ctrl + B, , | Rename window | Rename the current window. |
| Ctrl + B, N | Next window | Change to the next window. |
| Ctrl + B, P | Previous window | Change to the previous window. |
| Ctrl + B, L | Last window | Move to the previously selected window (lowercase l). |
| Ctrl + B, 0-9 | Select window by number | Select windows 0 to 9 directly. |
| Ctrl + B, ' | Select window by index | Prompt for a window index to select. |
| Ctrl + B, W | Choose window | Choose the current window interactively from a list. |
| Ctrl + B, . | Move window | Prompt for an index to move the current window to. |
| Ctrl + B, F | Find window | Prompt to search for text in open windows. |
| Ctrl + B, I | Window info | Display some information about the current window. |
| Ctrl + B, Alt + N | Next window with activity | Move to the next window with a bell or activity marker. |
| Ctrl + B, Alt + P | Previous window with activity | Move to the previous window with a bell or activity marker. |
| Ctrl + B, % | Split left and right | Split the current pane into two, left and right. |
| Ctrl + B, " | Split top and bottom | Split the current pane into two, top and bottom. |
| Ctrl + B, X | Kill pane | Kill the current pane. |
| Ctrl + B, O | Next pane | Select the next pane in the current window. |
| Ctrl + B, ; | Last pane | Move to the previously active pane. |
| Ctrl + B, ↑/↓/←/→ | Select pane by direction | Change to the pane above, below, to the left, or to the right of the current pane. |
| Ctrl + B, Q | Show pane numbers | Briefly display pane indexes; press a number to jump to that pane. |
| Ctrl + B, Z | Zoom pane | Toggle zoom state of the current pane (fullscreen within the window). |
| Ctrl + B, { | Swap with previous pane | Swap the current pane with the previous pane. |
| Ctrl + B, } | Swap with next pane | Swap the current pane with the next pane. |
| Ctrl + B, Ctrl + O | Rotate panes forwards | Rotate the panes in the current window forwards. |
| Ctrl + B, Alt + O | Rotate panes backwards | Rotate the panes in the current window backwards. |
| Ctrl + B, ! | Break pane to window | Break the current pane out of the window into its own window. |
| Ctrl + B, M | Mark pane | Mark the current pane, used as the default source for join and swap. |
| Ctrl + B, Shift + M | Clear marked pane | Clear the marked pane (uppercase M). |
| Ctrl + B, Space | Next layout | Arrange the current window in the next preset layout. |
| Ctrl + B, Alt + 1-7 | Preset layouts | Arrange 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 cell | Resize the current pane in steps of one cell. |
| Ctrl + B, Alt + ↑/↓/←/→ | Resize pane by five cells | Resize the current pane in steps of five cells. |
| Ctrl + B, [ | Enter copy mode | Enter copy mode to copy text or view the scrollback history. |
| Ctrl + B, ] | Paste buffer | Paste the most recently copied buffer of text. |
| Ctrl + B, Page Up | Copy mode and scroll up | Enter copy mode and scroll one page up. |
| Ctrl + B, # | List paste buffers | List all paste buffers. |
| Ctrl + B, = | Choose buffer to paste | Choose which buffer to paste interactively from a list. |
| Ctrl + B, - | Delete buffer | Delete the most recently copied buffer of text. |
| Q | Exit copy mode | Cancel and leave copy mode. |
| Space | Begin selection | Start selecting text from the cursor position. |
| Enter | Copy selection and exit | Copy the current selection and exit copy mode. |
| V | Rectangle selection | Toggle rectangle (block) selection mode. |
| Shift + V | Select line | Select the current line (uppercase V). |
| / | Search forward | Search forward for the specified text. |
| ? | Search backward | Search backwards for the specified text. |
| N | Repeat search | Repeat the last search in the same direction. |
| Shift + N | Repeat search reversed | Repeat the last search in the reverse direction (uppercase N). |
| G | Top of history | Scroll to the top of the history. |
| Shift + G | Bottom of history | Scroll to the bottom of the history (uppercase G). |
| Ctrl + U | Half page up | Scroll up by half a page. |
| Ctrl + D | Half page down | Scroll down by half a page. |
| Ctrl + B | Page up | Scroll up by one page. |
| Ctrl + F | Page down | Scroll down by one page. |
| 0 | Start of line | Move the cursor to the start of the line. |
| $ | End of line | Move the cursor to the end of the line. |
| W | Next word | Move to the next word. |
| B | Previous word | Move to the start of the previous word. |
| % | Matching bracket | Move to the next matching bracket. |
| Ctrl + B, : | Command prompt | Enter the tmux command prompt to type commands directly. |
| Ctrl + B, ? | List key bindings | List all key bindings. |
| Ctrl + B, T | Show clock | Show the time in the current pane. |
| Ctrl + B, R | Redraw client | Force redraw of the attached client. |
| Ctrl + B, ~ | Show messages | Show previous messages from tmux, if any. |
| Ctrl + B, Ctrl + B | Send prefix | Send 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.