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

Published by gbenson

I make things // he/him

Published