Shutdown Command Not Found? Add PATH in Debian 11 Bullseye

If you are a user of Ubuntu, you may found that shutdown, reboot and a few other commands does not work in Debian Linux. And it outputs “bash: shutdown: command not found”.

I was thinking that Debian does not have these commands out-of-the-box when I was first time trying out the system, until I realized it is an environment variables issue.

There are several standard variables in Linux environments, including PATH, HOME, SHELL, etc. The PATH specifies separated list of directories to search for commands. For example, the Firefox executable file is installed to /usr/bin/firefox and /usr/bin is in your PATH. So you may type firefox simply to run it.

Usually, the shutdown and a few other system action commands locate in /usr/sbin. Ubuntu has the directory in PATH for all admin users, so users may run them directly. However, Debian and some other Linux do not have them in PATH for non-root users.

Run shutdown, reboot, poweroff command in Debian / Fedora Linux:

Commands in /usr/sbin target for users with superuser (root) privileges. And, the correct way to run these commands is using “sudo” at the beginning. Such as:

sudo shutdown +60
sudo reboot

Though you may type the full path (e.g., /usr/sbin/shutdown now).

Add /usr/sbin to your user PATH:

If you insists, add “/usr/sbin” to the PATH via command export PATH=$PATH:/usr/sbin will make it work on current terminal or command console.

[email protected]:~$ export PATH=$PATH:/usr/sbin
[email protected]:~$ shutdown -r +60
Reboot scheduled for Fri 2021-10-15 13:08:38EDT,use 'shutdown -c' to cancel.

To make it permanent, so it will work just like in Ubuntu, run command to add the export PATH=$PATH:/usr/sbin line to the end of user’s “.bashrc” file. And re-open the current terminal/console.

sh -c 'echo "export PATH=$PATH:/usr/sbin" >> ~/.bashrc'
NOTE: Next time you need to add or change the user PATH. You have to edit this line you added via the last command.
Merilyn Ne
Hi, I'm Merilyn Ne, a computer geek working on Ubuntu Linux for many years and would like to write useful tips for beginners. Forgive me for language mistakes. I'm not a native speaker of English.