How to append to a file as sudo?
Posted
by obvio171
on Super User
See other posts from Super User
or by obvio171
Published on 2010-05-01T05:50:00Z
Indexed on
2010/05/01
5:58 UTC
Read the original article
Hit count: 309
I want to do:
echo "something" >> /etc/config_file
But, since only the root user has write permission to this file, I can't do that. But this:
sudo echo "something" >> /etc/config_file
also doesn't work. Is there any way to append to a file in that situation without having to first open it with a sudo
'd editor and then appending the new content by hand?
© Super User or respective owner