This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.
There are a lot of times when I just want to append something to /etc/hosts or a similar file but end up not being able to because both > and >> are not allowed, even with root.
Is there someway to make this work without having to su or sudo su into root?
Use
tee --appendortee -a.Make sure to avoid quotes inside quotes.
To avoid printing data back to the console, redirect the output to /dev/null.
Remember about the (
-a/--append) flag! Justteeworks like>and will overwrite your file.tee -aworks like>>and will write at the end of the file.