| by Arround The Web | No comments

Gary Benson: sudo tee >/dev/null

Need to redirect to a file from sudo? Use sudo tee >/dev/null:

$ sudo ls -l /root >/root/files.list
-bash: /root/files.list: Permission denied
$ sudo ls -l /root | sudo tee /root/files.list >/dev/null
$ sudo ls -l /root/files.list
-rw-r--r-- 1 root root 94 Oct 18 09:31 /root/files.list
Share Button

Source: Planet GNU

Leave a Reply