I'm trying to wrap my head around the thinking behind doing say

echo "nameserver" | sudo tee -a /etc/resolv.conf

rather than

echo "nameserver" >> /etc/resolv.conf

as root (e.g., after su or sudo bash). Is it a minimize time as root thing or is there something else to it?

  • 2
    this is not RPi related ... it is a linux question
    – jsotola
    Apr 10, 2018 at 4:41
  • 1
    Is it really a Linux idiom as opposed to a Pi Linux idiom? The place where (I think) I've encountered it the most is the context of the Pi – but most of my commuting life is spent of BSD systems. My interest it the question is around writing for a Pi audience, personally I'd do it with vi.
    – dlu
    Apr 10, 2018 at 5:09

1 Answer 1


It's a common Linux idiom. The idea behind it is to run only the tee process as root instead of a shell. Since tee is very simple, it's much less likely to have bugs or respond to unexpected user input in a dangerous way, compared to e.g. bash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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