output for the command sudo apt install sudo displayed in cool retro term

Sudo command not found? Here's an easy fix

David Rutland
David Rutland CLI

Sudo is probably the most important command you'll ever use on Linux. It gives you god-like powers in the terminal, and the ability to do absolutely anything you want in the terminal (for good or evil).

"sudo: command not found" isn't a common error, but if you don't fix it, you won't be able to update packages, install software, or even perform basic maintanence.

What is the sudo command used for on Linux?

Unless you make a habit of logging into Linux as root (never a good idea), you have to preface any privileged command with sudo. Sudo gives you the mystical powers of a super user, and without it, you're more-or-less restricted to launching already installed applications, or creating and manipulating files in your home directory.

For a complete description of what sudo can be used for and how to use it, enter the following command into a terminal:

man sudo

Man page entry for sudo

Without sudo, most of the filesystem will be inaccessible to you, and you won't be able to elevate your privilege to perform any restricted operations.

In a recent analysis of most-used Linux commands , we found sudo to be our third most used command overall.

Why is the the sudo command not found? Where did sudo go?

Sudo should installed on most Linux systems when you set them up for the first time, and by default, the sudo binary is located in /usr/bin/sudo.

We've seen the "Sudo: Command Not Found" message several times - usually after installing a new Linux system on a remote VPS or on a virtual machine.

You can actual force this error by deleting sudo with:

sudo apt remove /usr/bin/sudo

...or by accidentally moving it to another location.

Your first response on finding that sudo isn't installed might be to try and install sudo with:

sudo apt install sudo

Your terminal may even helpfully suggest that you use the above command. However, as you don't have sudo installed, you don't have the necessary privileges to install sudo.

If you receive the error message: "Sudo: Command Not Found", the first thing you should do is check if sudo is present on your system.

Open a terminal and enter:

ls /usr/bin/sudo

If sudo isn't present, you'll see the following message: ls: cannot access '/usr/bin/sudod': No such file or directory.

Here's the simple fix for "Sudo: Command Not Found" on Linux

The root account on Linux doesn't need to use sudo in order to install packages, and fortunately, it's easy to get root access on your physical machine or VM.

Restart Linux, either by selecting log out > restart or simply restart from your power or system menu.

Alternatively, power off your machine, then turn it on again.

As soon as your PC starts to boot, press and hold shift or Escape to bring up the grub menu.

Choose Advanced Options then select the most recent kernel version with Recovery mode.

Gnu Grub advance menu with a recovery mode entry highlighted

Towards the bottom of the Recovery menu, you'll see an option to "Drop to root shell prompt". Select this.

Grub system recovery menu with "Drop to root shell prompt" highlighted

Once in the root shell, you can install the sudo package, and add your user to the sudo group.

On Debian, Ubuntu, and related distros:

apt install sudo
usermod -aG sudo username

For Arch and derivatives such as Manjaro:

pacman -S sudo
usermod -aG wheel username
Installing sudo using the root shell

Make sure to replace username with the actual username of your usual user.

You can now reboot as normal, and go about your day with full sudo powers!

The power of sudo at your fingertips

Sudo is a powerful tool, and it's easy to make a mistake on the command line. If sudo vanished due a mistyped command, such as accidentally moving the binary to another location, it's possible you may need to take more care when typing commands.

Though they may not have helped in this specific case, there are tools that can assist with suggestions and help you quickly remedy command line mistakes.