How to Append to a File Using Sudo

Via the command line, in order to append to a file, you would typically use redirection (i.e. >>). However, you won’t be able to do this as a regular user against a root-owned file. Enter the tee command:

echo some_text | sudo tee -a /path/file