Use Bash Keyboard Shortcuts

Cameron Nokes
InstructorCameron Nokes
Share this video with your friends

Social Share Links

Send Tweet
Published 6 years ago
Updated 5 years ago

Bash keyboard shortcuts make it faster and easier to get things done at the terminal. In this lesson we'll look at the following shortcuts:

  • Ctrl+A - go to the beginning of a line
  • Ctrl+E- go to the end of a line
  • Ctrl+K - clears line up to the cursor
  • Ctrl+W - delete last word
  • Ctrl+L - clear the screen (equivalent of the clear command)

Note: these shortcuts work on Terminal, iTerm 2, and Hyper. If you are using an alternative terminal, they may not work.

Instructor: [00:00] Let's say I have a long command here, I want to go to the beginning of the line, I want to go back here. I can use Ctrl+A to go to the beginning of the line, and then Ctrl+E to go back to the end.

[00:12] I can also use Ctrl+K to clear the entire line up to my cursor. You can see I'm in the middle of the line, I'm going to do Ctrl+K, it's going to clear all the text up to it. I can use Ctrl+W to delete the last word. Ctrl+W, Ctrl+W deletes those words. Then finally, Ctrl+L clears the screen. This is equivalent to the clear command which does the same thing.

egghead
egghead
~ 3 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today