hero-background-image-header

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

By Flatiron SchoolOctober 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:

1
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)

1
ctrl + e

3. jump to the beginning of the line

1
ctrl + a

4. delete the word immediately to the left

1
ctrl + w

5. delete entire line

1
ctrl + u

This one is now a personal favorite….

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

1
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 

1
mkdir -p mamabear/smokey/pokey/loki

8. chain commands using &&

1
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)

1
ls - thor

10. generate random password

1
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.

; )

Headshot of Flatiron School

Flatiron School

Blog Post Author

All Articles by Flatiron School