You may have noticed that you get Permission denied when you execute something like this:
sudo ls > /root/ls.out
The reason is that the redirect part doesn't run under sudo. As a workaround you can do:
sudo su -c 'ls > /root/ls.out'
su -c basically switches the current user to root and runs the specified command.
Normally su asks you to enter the root password, but you can run it under sudo and enter your current user password instead.