Utility‎ > ‎

tee

The right tool for the right task: 'tee'

tee - read from standard input and write to standard output and files

So your commandline becomes

% echo "output" | sudo tee -a file

The advantage of tee over executing Bash with administrative permissions is:

  • You do not execute Bash with administrative permissions
  • Only the 'write to file' part runs with advanced permissions
  • Quoting of a complex command is much easier
Comments