commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This is the solution to the common mistake made by sudo newbies, since
sudo echo "foo bar" >> /path/to/some/file
does NOT add to the file as root.
sudo echo "foo bar" > /path/to/some/file
should be replaced by
echo "foo bar" | sudo tee /path/to/some/file
And you can add a >/dev/null in the end if you're not interested in the tee stdout :
echo "foo bar" | sudo tee -a /path/to/some/file >/dev/null
There is 1 alternative - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.