I want to check if a file exists like so
[ -f /path/to/file/ ]
However I am running this command as a regular user and the file is owned by root. How can I use sudo to accomplish this.
sudo [ -f /path/to/file/ ] does not work.
What you're describing should work fine - as long as you're using absolute paths, and
I see a trailing
Also note that unless something along the way is not readable
To complete things, on the opposite side, if you want to check from root if a file or directory is readable for a certain user you can use