Keyboard Shortcuts

Essential keyboard shortcuts for terminal and editors.

Bash/Zsh Readline Shortcuts

Line Editing:

Shortcut Action

Ctrl+A

Move to start of line

Ctrl+E

Move to end of line

Ctrl+B

Move back one character

Ctrl+F

Move forward one character

Alt+B

Move back one word

Alt+F

Move forward one word

Ctrl+XX

Toggle between start and current position

Deletion:

Shortcut Action

Ctrl+D

Delete character under cursor (or exit if empty)

Ctrl+H

Delete character before cursor (Backspace)

Ctrl+W

Delete word before cursor

Alt+D

Delete word after cursor

Ctrl+U

Delete from cursor to start of line

Ctrl+K

Delete from cursor to end of line

Ctrl+Y

Paste (yank) deleted text

Alt+Y

Rotate through yank ring (after Ctrl+Y)

History:

Shortcut Action

Ctrl+R

Reverse search history

Ctrl+S

Forward search history (enable: stty -ixon)

Ctrl+G

Cancel search

Ctrl+P

Previous command (Up arrow)

Ctrl+N

Next command (Down arrow)

Alt+.

Insert last argument of previous command

Alt+[0-9]+.

Insert Nth argument of previous command

!!

Repeat last command

!$

Last argument of last command

!^

First argument of last command

!*

All arguments of last command

!:n

Nth argument of last command

!-2

Second-to-last command

oldnew

Replace first occurrence in last command

!!:gs/old/new

Replace all occurrences in last command

Control:

Shortcut Action

Ctrl+L

Clear screen (keeps current line)

Ctrl+C

Cancel current command (SIGINT)

Ctrl+Z

Suspend current process (SIGTSTP)

Ctrl+D

Exit shell / EOF

Ctrl+S

Freeze terminal output

Ctrl+Q

Resume terminal output

Ctrl+\

Quit (SIGQUIT, core dump)

Completion:

Shortcut Action

Tab

Complete command/path/argument

Tab Tab

Show all completions

Alt+?

List completions

Alt+*

Insert all completions

Ctrl+X /

List file completions

Ctrl+X ~

List username completions

Ctrl+X $

List variable completions

Job Control:

Shortcut Action

jobs

List background jobs

fg

Bring last job to foreground

fg %n

Bring job n to foreground

bg

Resume last job in background

bg %n

Resume job n in background

%1

Reference job 1

%%

Reference current job

%+

Reference current job

%-

Reference previous job

Vim Normal Mode

Movement:

Shortcut Action

h/j/k/l

Left/down/up/right

w

Next word start

W

Next WORD start (space-separated)

b

Previous word start

B

Previous WORD start

e

Next word end

E

Next WORD end

0

Start of line

^

First non-blank character

$

End of line

gg

First line

G

Last line

nG or :n

Go to line n

%

Matching bracket

{

Previous paragraph

}

Next paragraph

H

Top of screen

M

Middle of screen

L

Bottom of screen

Ctrl+D

Half page down

Ctrl+U

Half page up

Ctrl+F

Full page down

Ctrl+B

Full page up

zz

Center current line

zt

Current line to top

zb

Current line to bottom

f{char}

Find character forward

F{char}

Find character backward

t{char}

Till character forward

T{char}

Till character backward

;

Repeat f/F/t/T forward

,

Repeat f/F/t/T backward

Editing:

Shortcut Action

i

Insert before cursor

I

Insert at line start

a

Append after cursor

A

Append at line end

o

Open line below

O

Open line above

x

Delete character

X

Delete character before

dd

Delete line

D

Delete to end of line

cc

Change line

C

Change to end of line

s

Substitute character

S

Substitute line

r{char}

Replace single character

R

Enter replace mode

J

Join lines

gJ

Join lines (no space)

u

Undo

Ctrl+R

Redo

.

Repeat last change

~

Toggle case

g~{motion}

Toggle case over motion

gu{motion}

Lowercase over motion

gU{motion}

Uppercase over motion

>>{motion}

Indent

<<{motion}

Unindent

={motion}

Auto-indent

Operators (verb + motion/text object):

Operator Action

d

Delete

c

Change

y

Yank (copy)

>

Indent right

<

Indent left

=

Auto-indent

gq

Format/wrap text

g~

Toggle case

gu

Lowercase

gU

Uppercase

Text Objects (use with operators):

Text Object Description

iw

Inner word

aw

A word (includes space)

iW

Inner WORD

aW

A WORD

is

Inner sentence

as

A sentence

ip

Inner paragraph

ap

A paragraph

i" or i' or i`

Inner quotes

a" or a' or a`

A quotes (includes quotes)

i( or ib

Inner parentheses

a( or ab

A parentheses

i[

Inner brackets

a[

A brackets

i{ or iB

Inner braces

a{ or aB

A braces

i<

Inner angle brackets

a<

A angle brackets

it

Inner tag (HTML/XML)

at

A tag

Search:

Shortcut Action

/{pattern}

Search forward

?{pattern}

Search backward

n

Next match

N

Previous match

*

Search word under cursor (forward)

#

Search word under cursor (backward)

g*

Partial word search forward

g#

Partial word search backward

:noh

Clear search highlight

Marks:

Shortcut Action

m{a-z}

Set local mark

m{A-Z}

Set global mark

'{mark}

Go to mark (line start)

`{mark}

Go to mark (exact position)

''

Previous position (line)

` `

Previous position (exact)

:marks

List all marks

Registers:

Shortcut Action

"{register}

Use register for next operation

""

Unnamed (default) register

"0

Last yank

"1-9

Delete history

"a-z

Named registers

"A-Z

Append to named register

"_

Black hole (discard)

"+

System clipboard

"*

X11 primary selection

"/

Last search pattern

":

Last command

".

Last inserted text

"%

Current filename

:reg

Show register contents

Macros:

Shortcut Action

q{register}

Start recording macro

q

Stop recording

@{register}

Play macro

@@

Repeat last macro

{count}@{register}

Play macro N times

Vim Insert Mode

Shortcut Action

Ctrl+O

Execute one normal mode command

Ctrl+R {register}

Paste register contents

Ctrl+R =

Insert expression result

Ctrl+R "

Paste unnamed register

Ctrl+R +

Paste system clipboard

Ctrl+R /

Paste last search

Ctrl+A

Insert previously inserted text

Ctrl+W

Delete word before cursor

Ctrl+U

Delete to line start

Ctrl+T

Indent current line

Ctrl+D

Unindent current line

Ctrl+N

Next completion

Ctrl+P

Previous completion

Ctrl+X Ctrl+F

Filename completion

Ctrl+X Ctrl+L

Line completion

Ctrl+X Ctrl+K

Dictionary completion

Ctrl+X Ctrl+O

Omni completion

Ctrl+V {char}

Insert literal character

Ctrl+V u{hex}

Insert Unicode character

Ctrl+K {digraph}

Insert digraph

Ctrl+[ or Escape

Exit insert mode

Ctrl+C

Exit insert mode (no abbreviation expansion)

Vim Visual Mode

Shortcut Action

v

Character-wise visual

V

Line-wise visual

Ctrl+V

Block visual

gv

Reselect last selection

o

Move to other end of selection

O

Move to other corner (block mode)

aw

Select a word

ab

Select a block with ()

aB

Select a block with {}

at

Select a tag block

ib

Select inner () block

iB

Select inner {} block

it

Select inner tag block

>

Indent selection

<

Unindent selection

~

Toggle case

u

Lowercase

U

Uppercase

d

Delete selection

c

Change selection

y

Yank selection

I

Insert at start of each line (block)

A

Append to end of each line (block)

r{char}

Replace all selected with char

Vim Command Mode

Command Action

:w

Save

:w {file}

Save as

:q

Quit

:q!

Force quit

:wq or :x

Save and quit

:wa

Save all

:qa

Quit all

:e {file}

Edit file

:e!

Reload file (discard changes)

:bn / :bp

Next/previous buffer

:bd

Delete buffer

:ls

List buffers

:sp {file}

Horizontal split

:vs {file}

Vertical split

:{range}s/old/new/g

Substitute

:{range}s/old/new/gc

Substitute with confirm

:%s/old/new/g

Substitute in entire file

:g/{pattern}/d

Delete lines matching pattern

:v/{pattern}/d

Delete lines NOT matching pattern

:sort

Sort lines

:sort u

Sort and remove duplicates

:r {file}

Read file into buffer

:r !{cmd}

Read command output

:!{cmd}

Run shell command

:.!{cmd}

Filter current line through command

:{range}!{cmd}

Filter range through command

:set {option}

Set option

:set {option}?

Show option value

:set no{option}

Unset option

:h {topic}

Help

Vim Window Management

Shortcut Action

Ctrl+W s

Horizontal split

Ctrl+W v

Vertical split

Ctrl+W q

Close window

Ctrl+W c

Close window (keeps buffer)

Ctrl+W o

Close other windows

Ctrl+W w

Cycle through windows

Ctrl+W h/j/k/l

Move to left/down/up/right window

Ctrl+W H/J/K/L

Move window to far left/bottom/top/right

Ctrl+W =

Equal window sizes

Ctrl+W _

Maximize height

Ctrl+W |

Maximize width

Ctrl+W +/-

Increase/decrease height

Ctrl+W >/<

Increase/decrease width

Ctrl+W r

Rotate windows

Ctrl+W R

Rotate windows (reverse)

Ctrl+W x

Exchange with next window

Ctrl+W T

Move window to new tab

tmux Shortcuts

Default prefix is Ctrl+B

Sessions:

Shortcut Action

tmux new -s name

New named session

tmux attach -t name

Attach to session

tmux ls

List sessions

prefix d

Detach from session

prefix $

Rename session

prefix s

List sessions (interactive)

prefix ( / )

Previous/next session

Windows:

Shortcut Action

prefix c

Create window

prefix ,

Rename window

prefix n

Next window

prefix p

Previous window

prefix [0-9]

Go to window N

prefix l

Last window

prefix &

Kill window

prefix w

List windows

prefix f

Find window

Panes:

Shortcut Action

prefix "

Split horizontally

prefix %

Split vertically

prefix arrow

Navigate panes

prefix o

Next pane

prefix ;

Last pane

prefix x

Kill pane

prefix z

Toggle zoom pane

prefix {

Move pane left

prefix }

Move pane right

prefix q

Show pane numbers

prefix !

Break pane to window

prefix Ctrl+arrow

Resize pane

prefix Space

Cycle layouts

Copy Mode (vi-style):

Shortcut Action

prefix [

Enter copy mode

q

Exit copy mode

Space

Start selection

Enter

Copy selection

prefix ]

Paste buffer

/

Search forward

?

Search backward

n

Next match

N

Previous match

fzf Shortcuts

In fzf interface:

Shortcut Action

Ctrl+J/K

Move down/up

Ctrl+N/P

Move down/up (alt)

Enter

Select

Tab

Toggle selection (multi)

Shift+Tab

Toggle and move up

Ctrl+A

Select all

Ctrl+D

Deselect all

Ctrl+T

Toggle preview

Ctrl+/

Toggle preview wrap

Alt+J/K

Scroll preview

Ctrl+C

Abort

Escape

Abort

Shell integration:

Shortcut Action

Ctrl+T

File search

Ctrl+R

History search

Alt+C

Directory search

**Tab

Fuzzy completion

With commands:

# Find files
vim $(fzf)

# Find and kill process
kill -9 $(ps aux | fzf | awk '{print $2}')

# Git checkout branch
git checkout $(git branch | fzf)

# SSH to host
ssh $(grep "^Host" ~/.ssh/config | awk '{print $2}' | fzf)

Git Shortcuts

Common aliases (add to .gitconfig):

[alias]
    st = status
    co = checkout
    br = branch
    ci = commit
    di = diff
    dc = diff --cached
    lg = log --oneline --graph --all
    last = log -1 HEAD
    unstage = reset HEAD --
    amend = commit --amend
    cp = cherry-pick
    undo = reset --soft HEAD^
    wip = !git add -A && git commit -m 'WIP'

Quick reference:

Command Action

git stash

Stash changes

git stash pop

Apply and remove stash

git stash list

List stashes

git stash show -p

Show stash diff

git diff HEAD~1

Diff with previous commit

git log -p -1

Show last commit with diff

git reset --hard HEAD

Discard all changes

git checkout — .

Discard unstaged changes

git clean -fd

Remove untracked files/dirs

git rebase -i HEAD~3

Interactive rebase last 3

git bisect start

Start bisect

git reflog

View ref history

kubectl Shortcuts

Aliases (add to shell config):

alias k='kubectl'
alias kgp='kubectl get pods'
alias kgs='kubectl get svc'
alias kgd='kubectl get deployments'
alias kgn='kubectl get nodes'
alias kga='kubectl get all'
alias kdp='kubectl describe pod'
alias kds='kubectl describe svc'
alias kdd='kubectl describe deployment'
alias kl='kubectl logs'
alias klf='kubectl logs -f'
alias ke='kubectl exec -it'
alias kaf='kubectl apply -f'
alias kdf='kubectl delete -f'
alias kgpa='kubectl get pods -A'
alias kgsa='kubectl get svc -A'
alias kcns='kubectl config set-context --current --namespace'
alias kcgc='kubectl config get-contexts'
alias kcuc='kubectl config use-context'

Quick operations:

Pattern Action

k get po -o wide

Pods with node info

k get po -o yaml

Pod YAML

k get po --show-labels

Pods with labels

k get po -l app=nginx

Pods by label

k get events --sort-by=.lastTimestamp

Recent events

k top pod

Pod resource usage

k top node

Node resource usage

k run tmp --image=busybox -it --rm — sh

Debug pod

k port-forward svc/name 8080:80

Port forward

k rollout restart deploy/name

Rolling restart

k rollout status deploy/name

Check rollout

k rollout undo deploy/name

Rollback

k scale deploy/name --replicas=3

Scale

Browser Shortcuts (Chrome/Firefox)

Navigation:

Shortcut Action

Ctrl+T

New tab

Ctrl+W

Close tab

Ctrl+Shift+T

Reopen closed tab

Ctrl+Tab

Next tab

Ctrl+Shift+Tab

Previous tab

Ctrl+[1-8]

Go to tab N

Ctrl+9

Last tab

Ctrl+L

Focus address bar

Ctrl+K

Search from address bar

Alt+Left/Right

Back/forward

Ctrl+N

New window

Ctrl+Shift+N

Private window

F11

Toggle fullscreen

F5 or Ctrl+R

Reload

Ctrl+Shift+R

Hard reload (bypass cache)

Page actions:

Shortcut Action

Ctrl+F

Find on page

Ctrl+G

Next match

Ctrl+Shift+G

Previous match

Ctrl+P

Print

Ctrl+S

Save page

Ctrl+D

Bookmark page

Ctrl+U

View source

F12

Developer tools

Ctrl+Shift+C

Inspect element

Ctrl+Shift+J

Console

Space

Page down

Shift+Space

Page up

Home

Top of page

End

Bottom of page

Ctrl++/-

Zoom in/out

Ctrl+0

Reset zoom

Hyprland Shortcuts

Default MOD key is Super (Windows key)

Window management:

Shortcut Action

MOD+Q

Kill active window

MOD+M

Exit Hyprland

MOD+V

Toggle floating

MOD+J

Toggle split

MOD+P

Pseudo tile

MOD+F

Toggle fullscreen

MOD+Arrow

Move focus

MOD+H/J/K/L

Move focus (vim keys)

MOD+Shift+Arrow

Move window

MOD+[1-9]

Switch workspace

MOD+Shift+[1-9]

Move window to workspace

MOD+S

Toggle special workspace

MOD+Shift+S

Move to special

MOD+Scroll

Cycle workspaces

MOD+LMB

Move window (drag)

MOD+RMB

Resize window (drag)

Applications (common bindings):

Shortcut Action

MOD+Return

Terminal

MOD+D

Application launcher (wofi/rofi)

MOD+E

File manager

MOD+B

Browser

Screenshot (with grimblast):

Shortcut Action

Print

Screenshot region

MOD+Print

Screenshot active window

MOD+Shift+Print

Screenshot all monitors