Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the default path of sudo command?

I checked in some linux flavours and some solaris flavours, it is /usr/bin/sudo

If a solaris machine is not bundled with sudo, Where it will get installed if we installed it by an external package.

I am developing a discovery script which is common for all unix based systems. It will get executed based on the uname command's output.

To get the machine information without root user, i can create a session using sudo command, for that i need the default path of the sudo command.

share|improve this question
add comment

2 Answers 2

default path for linux should usually be /usr/bin/sudo, but for all unix, or even some customized linux distros, it could really be anywhere (say /usr/local/bin/sudo, or even something link /opt/bin/sudo, or /srv/bin/sudo, etc.)

assuming it is in your PATH (which it should be), then you should discover it by using which

sudocmd=`which sudo`

because the installation prefix on the same distribution could vary, depending on how it is installed.

share|improve this answer
add comment

Use whereis to find command location/path

$ whereis whereis
sudo: /usr/bin/whereis /usr/share/man/man1/whereis.1.gz
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.