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
Written by Rafael Bika
Related protips
3 Responses
Important note about #2 is that it's not a global replace. See: https://coderwall.com/p/_-_cmq
over 1 year ago
·
@shawncplus I should have said this. I updated the post, thx!
over 1 year ago
·
good list, CTRL-r is also pretty handy for long commands that you typed previously (tcpdump filters, quick one-liners)
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#