285
64
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 the following also doesn't work.
sudo echo "something" >> /etc/config_file
Is there a 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?
Strongly related: Redirecting stdout to a file you don't have write permission on (on Unix & Linux). Weakly related:
– Scott – 2015-08-28T12:47:06.883ls
with directory path shows files, butls
with file pattern does not?I am using Ubuntu 9.04 and am able to use sudo for every command I've needed to so far. Spawning a sub-shell worked. – Matt Norris – 2009-10-13T14:57:09.367