aecfwa
Last Updated: February 25, 2016
·
582
· rbika

Three very useful command line tips

1. sudo !!
Runs the last command as root.

2. ^foo^bar
Runs the last command replacing the first occurrence of foo by bar.

3. > text.txt
Empty the file named text.txt. If the file doesn't exists, a new empty file is created.

You can check more useful tips at commandlinefu.com

3 Responses
Add your response

6524

Important note about #2 is that it's not a global replace. See: https://coderwall.com/p/_-_cmq

over 1 year ago ·
6529

@shawncplus I should have said this. I updated the post, thx!

over 1 year ago ·
6743

good list, CTRL-r is also pretty handy for long commands that you typed previously (tcpdump filters, quick one-liners)

over 1 year ago ·