Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a fairly new Linux user and I've noticed that some commands are only available to the superuser - shutdown for example. I often get confused when I know there's a command, try to execute it but get told it doesn't even exist - yet all I needed was to be root to execute it.

My question is why don't these commands say that you don't have enough privileges to run it, or say that you need to be root? Is there some technical reason for this or is it just the way it is?

share|improve this question
up vote 4 down vote accepted

The response you are probably seeing indicates not that the commands don't exist, but that they "aren't found":

telemachus ~ $ ifconfig -a
bash: ifconfig: command not found

Some error messages are useless, but this one is actually relatively helpful. The words "not found" tell you where the problem is. Your shell (in my case it's Bash, clearly) looks for commands along its $PATH variable. The PATH is a set of colon-separated values. Each value is a directory where executable (binary) programs go, and the shell looks for commands in order from left to right along that chain of directories. Here's how to see what your PATH is:

telemachus ~ $ echo $PATH

(Note that case matters, PATH is all upper. Also the $ matters.) So my shell looks for commands in the bin directory in my home folder, then in /usr/local/bin, then in /usr/bin etc. The order matters, because sometimes you will have two versions of one program, and you want to make sure that you find a specific one first. (I have a different version of Ruby in my $HOME/bin directory than the system-wide one, and I want it found first.)

To add a directory to your PATH, you can normally edit your shell's profile. Depending on what distribution of Linux you are using, that file will be called .profile or .bash_profile, and it will be in your home directory. Files that start with a . (often called dot-files) are hidden by default. They won't show up in a gui file-manager, and the ls command won't see them (without help). To see what's present in your home, open a shell (you will be in your home directory by default in a new shell), and type ls -A. The -A flag tells the ls command to show hidden files. You should see either .profile or .bash_profile, which you can then edit. Add a colon and the full path of the directory you want (a full path should start with a / to indicate its position from the root of your drive). You don't want a colon after the last value. So if you have a normal PATH, you can add /sbin this way:


However, all of this said, you still can't get directly at /sbin/shutdown that way:

telemachus ~ $ /sbin/shutdown -h now
shutdown: you must be root to do that!

By giving the command's full path, I "found" the command, but I still couldn't run it. Some commands, like shutdown, require special privileges. To get permission to issue shutdown from a shell, you would need to use su or sudo depending on what kind of system you're on. I've already written a novel, so that's a story for another day.

share|improve this answer

The reason they are "non-existent" is because their location is not in our PATH environment variable. You can see the directories in your PATH by typing:

echo $PATH

and you can check the location of your command by typing

whereis shutdown

typically you will see that the directory of the command you are looking for is not in your PATH. You can add directories to your path by adding the following lines in your login script (~/.bash_profile).

export PATH
share|improve this answer

They are stored in /usr/sbin or /sbin directories which are not included in the user's PATH variable (by default).

share|improve this answer

Think about linux as a multiuser system and it will makes sense. You don't want the machine you're working on to be shut down by an other user. If root does it well, maybe he has some good reason to shut down it.

As user you should be able to do things that affect only your space. If you run linux as desktop (and you say you're new to it) you're probably running something like Ubuntu or similar. In these distributions you can use the gui to use almost everything and the system will ask you the password when needed.

On console you can get root access by using su command (if you know root's password) or sudo su if your distro uses sudo. After that you will have all the powers and privileges you need to break your system :P

share|improve this answer

Your Answer


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.