Redirect the output of a command to a file when using sudo
Rather than > or », use tee.
Redirecting the output of commands run with sudo requires a different approach. For instance considerFrom https://help.ubuntu.com/community/RootSudosudo ls > /root/somefilewill not work since it is the shell that tries to write to that file. You can usels | sudo tee -a /root/somefileto append, orls | sudo tee /root/somefileto overwrite contents.