Skip to content

Instantly share code, notes, and snippets.

@dtuite
Created March 3, 2014 02:25
Show Gist options
  • Save dtuite/9317467 to your computer and use it in GitHub Desktop.
Save dtuite/9317467 to your computer and use it in GitHub Desktop.
Pipe to a file with sudo permissions

Pipe to a file using sudo

The tee -a command will append changes to a file (just like to >>). The -a flag stands for "append".

echo "some text" | sudo tee -a write-protected.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment