Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicates:
How to append to a file as sudo?
sudo unable to write to /etc/profile

The following command does not work because the elevated privileges do not apply to the redirection.

sudo echo "myoutput" >> /etc/file_that_only_root_can_write

how can it be done?

share|improve this question

marked as duplicate by akira, quack quixote Jun 23 '10 at 19:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1… – akira Jun 23 '10 at 11:36
@akira you're probably right... I just started a new one because I didn't find those. – João Portela Jun 23 '10 at 14:34
up vote 6 down vote accepted
echo "myoutput" | sudo tee -a /etc/file_that_only_root_can_write
share|improve this answer
that it! thanks. – João Portela Jun 23 '10 at 14:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.