10 Useful to Somewhat Useful Bash Shortcuts: Every second saved is a second

Posted by Flatiron School  /  October 23, 2013

The following is a guest post by Brendan Manley and originally appeared on his blog. Brendan is currently in the Ruby-003 class at The Flatiron School. You can follow him on Twitter here.

1. move cursor one word to the left:

esc + b

Isn’t it annoying that you often find yourself holding down your left arrow key until it’s begging you to stop?

2. jump to the end of the line (figuratively…I mean with your cursor)

ctrl + e

3. jump to the beginning of the line

ctrl + a

4. delete the word immediately to the left

ctrl + w

5. delete entire line

ctrl + u

This one is now a personal favorite….

6. the equivalent of the browser back button, but in your terminal

cd -

Now, I know that everyone already knows about ‘cd ..’. However, tip number 6 is useful if you’re jumping around your directories with portkeys (Harry Potter reference).

7. create parent directory and children simultaneously 

mkdir -p mamabear/smokey/pokey/loki

8. chain commands using &&

rub && cd cool && ruby chronozoa.rb

why not?

9. use Chris Hemsworth’s striking good lucks to generate a list of when each file in the current directory was edited last (+ who did the deed)

ls - thor

10. generate random password

egrep -ioam1 ‘[a-z0-9]{8}’ /dev/urandom

Yes, you may never use this one. But now at least you know what you’re missing out on! ‘[a-z0-9]’ represents the characters that are allowed in the password you’ll be generating and {8} represents the character length.

; )