🎁

12 Days of Baddass Courses sale! Get instant access to the entire egghead library of courses and lessons for 58% off.

Runs out in:
15 : 05 : 59 : 32
Join egghead, unlock knowledge.

Want more egghead? It's 58% off for a limited time only!

This lesson is for members. Join us? Get access to all 3,000+ tutorials + a community with expert developers around the world.

Unlock All Content for 40% Off
1×
Become a member
to unlock all features
Autoplay

    Use Bash Keyboard Shortcuts

    Cameron NokesCameron Nokes
    bashBash

    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.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: 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.

    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.