Some command line shortcuts that might make your life easier. They’ve helped me, but sometimes I forget so I decided to group some of my favorites here.
To be specific, we’re talking bash. As a common default shell, there’s a good chance it’s what you’re using. So a lot of this can be found inside the bash manpage. If you’re using something else, I can’t say what of this might be compatible…
Event Designators
Ever need to repeat the last command? Easy, just use !!
$ echo some super-duper-annoy-to-retype command
some super-duper-annoy-to-retype command
$ !!
echo some super-duper-annoy-to-retype command
some super-duper-annoy-to-retype command
$ echo "!!" > what-was-that.txt
echo "echo some super-duper-annoy-to-retype command" > what-was-that.txt
$ cat what-was-that.txt
echo some super-duper-annoy-to-retype command
This is extremely handy if you meant to run the last command as sudo, just run sudo !!
Continue reading Command Line Shortcuts