aecfwa
Last Updated: February 25, 2016
·
569
· rbika
Avatar

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

Say Thanks
Respond

3 Responses
Add your response

6524
D54f65ad3ff9ee1c9c033a403d4b5f9f

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

over 1 year ago ·
6529
Avatar

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

over 1 year ago ·
6743
Fdbfa804fb643acb052de0e34289f3b6

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

over 1 year ago ·
Filed Under