Skip to content

Instantly share code, notes, and snippets.

@acamino
Last active December 19, 2024 07:26
Show Gist options
  • Save acamino/2bc8df5e2ed0f99ddbe7a6fddb7773a6 to your computer and use it in GitHub Desktop.
Save acamino/2bc8df5e2ed0f99ddbe7a6fddb7773a6 to your computer and use it in GitHub Desktop.
Shortcuts to Improve Your Bash & Zsh Productivity

Shortcut — Action

  • CTRL + A — Move to the beginning of the line
  • CTRL + E — Move to the end of the line
  • CTRL + [left arrow] — Move one word backward (on some systems this is ALT + B)
  • CTRL + [right arrow] — Move one word forward (on some systems this is ALT + F)
  • CTRL + U — (bash) Clear the characters on the line before the current cursor position
  • CTRL + U —(zsh) If you're using the zsh, this will clear the entire line
  • CTRL + K — Clear the characters on the line after the current cursor position
  • ESC + [backspace] — Delete the word in front of the cursor
  • CTRL + W — Delete the word in front of the cursor
  • ALT + D — Delete the word after the cursor
  • CTRL + R — Search history
  • CTRL + G — Escape from search mode
  • CTRL + - — Undo the last change
  • CTRL + L — Clear screen
  • CTRL + S — Stop output to screen
  • CTRL + Q — Re-enable screen output
  • CTRL + C — Terminate/kill current foreground process
  • CTRL + Z — Suspend/stop current foreground process
  • !! — Execute last command in history
  • !abc — Execute last command in history beginning with abc
  • !abc:p — Print last command in history beginning with abc

Source: http://www.geekmind.net/2011/01/shortcuts-to-improve-your-bash-zsh.html

bindkey -e
bindkey \^u backward-kill-line
@BirkhoffLee
Copy link

FYI: this StackOverflow page can solve a lot of questions you might have.

@b-o-g-d-a-n
Copy link

hey there, I think you have an error on line 13:
'CTRL + -(minus) — Undo the last change'

It is ctrl + _(underscore).

the 'bindkey -e' stands for emacs and those here are the basic emacs commands.

Fun Fact:
In most shells you can press 'ctrl + 7' to undo.
That works because with ctrl + 7 you send the underscore signal(^_).

Hope I helped you out a little bit :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment