Linux shell

Redirecting sudo output to file:

ls /root | sudo tee ls.txt > /dev/null

And for multi-line text:

sudo tee file.txt > /dev/null << EOF
foo
bar
baz
EOF