Useful keyboard shortcuts for Bash


I’ve been playing around with bash for the past two years now, and found some of these keyboard shortcuts to be very useful. I’ve tried to put the ones I use the most often on here. For other cool bash shortcuts and tricks, visit

  • CTRL + R: Reverse search through history for a previously used command;
  • CTRL + A: Moves your cursor to the beginning of the current line;
  • CTRL + E: Moves your cursor to the end of the current line;
  • ALT + F: Moves your cursor forward one word on the current line;
  • ALT + B: Moves your cursor backward one word on the current line;
  • CTRL + W: Deletes the word before the cursor;
  • ESC + D: Deletes the word after the cursor;
  • CTRL + U: Clears the line before the cursor position. If you are at the end of the line, clears the entire line;
  • CTRL + K: Clears the line after the cursor;
  • CTRL + C: Kills the current running process;
  • CTRL + Z: Suspends the current job and runs it as a background process;
  • TAB: Auto-complete files and folder names;

For the sake of completeness, I’ve added these other shortcuts that I saw on another website. However, I find that I do not use those on a regular basis. In reality, there are plenty more bash keyboard shortcuts around, but I just never bothered trying them out yet… For a much more extensive list of shortcuts (way too extensive for my tastes), visit web hosting uk‘s blog post on the subject.

  • CTRL + L: Clears the Screen (I use the “clear” command);
  • CTRL + H: Same as backspace;
  • CTRL + D: Exit the current shell (I type “exit” in Putty);
  • CTRL + T: Swaps the last two characters before the cursor;
  • ESC + T: Swaps the last two words before the cursor;
  • CTRL + XX: Moves between end-of-line and current cursor position;
  • CTRL + Y: Recovers previous deletion (Not file deletion!);
Advertisements

2 thoughts on “Useful keyboard shortcuts for Bash

    1. Hey Bert,
      I’m glad you found those useful. I find, with bash shortcuts, you never bother to learn them because you don’t think it’ll save that much time. But once you know them, you can’t really live without them. They’re a real time saver!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s