• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Fix: sudo: command not found Error

By Abhishek Ghosh May 18, 2024 7:00 am Updated on May 18, 2024

Fix: sudo: command not found Error

Advertisement

Encountering the “sudo: command not found” error can be frustrating, especially when you’re trying to perform administrative tasks on a Linux server. This error indicates that the system is unable to locate the sudo command, which is essential for executing commands with superuser privileges. Fortunately, there are several troubleshooting steps and solutions to resolve this issue and regain access to sudo functionality. The error looks like this:

Vim
1
2
3
$ sudo apt install mariadb
 
-bash: sudo: command not found

Also Read: What is Superuser (Root Account) in Unix & Linux

sudo (su “do”) is a command on Unix and Unix-like operating systems such as Linux or macOS that is used to start processes with the privileges of another user (e.g. the superuser root). In contrast to su, which does not belong to sudo, it is possible to configure which commands may be executed. sudo itself a program, with its own official website which troubleshoots various complex errors:

Advertisement

---

Vim
1
https://www.sudo.ws/docs/troubleshooting/

Usually, the sudo package by default is installed in most Linux distributions, but some Debian systems may not have it pre-installed. Usually, the sudo: command not found error is not a serious issue.

 

Understanding sudo: command not found Error

 

Before delving into the solutions, it’s essential to understand why the “sudo: command not found” error occurs. The sudo command is typically located in the /usr/bin directory, which is included in the system’s PATH environment variable. When you enter a command prefixed with sudo, the system searches the directories listed in the PATH variable to find the sudo executable. If it fails to locate sudo in any of these directories, it returns the “command not found” error.

To fix this error, logging into the system as the root user is required. You can also switch to the root user, which uncannily involves the sudo command:

Vim
1
sudo su -

Of course, if my username is abhishek and I am not in the sudoers group, then I may face this error. So, I need to add my username to the group.

Vim
1
usermod -aG sudo abhishek

Make sure your sudoers file has a sudo group added. Run visudo to modify the sudoers file and add the following line into it (if it is missing):

Vim
1
2
# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

If the sudo program is not at all installed, naturally it will throw the error. Ensure that sudo is installed on your system. You can do this by running the following command:

Vim
1
which sudo

If sudo is installed, the command will return the path to the sudo executable (e.g., /usr/bin/sudo). If sudo is not installed, you’ll need to install it using your package manager (e.g., apt-get, yum), for example:

Vim
1
apt update && apt install sudo

Next if still not fixed, we should check the PATH. Verify that the PATH environment variable is correctly configured and includes the directory where sudo is located (/usr/bin). You can check the PATH variable by running the following command:

Vim
1
echo $PATH

The above situations are common clauses of getting the error. There are other clauses too. The sudo command should have the correct permissions (typically executable by root) to be executed. You can check the permissions using the ls command:

Vim
1
ls -l /usr/bin/sudo

Fix sudo command not found Error

If the permissions are incorrect, you can use the chmod command to adjust them:

Vim
1
sudo chmod 755 /usr/bin/sudo

If sudo is installed but still not found, try reinstalling it using your package manager. This can help fix any corrupted installation or missing files:

Vim
1
2
sudo apt-get install --reinstall sudo     (for Debian-based systems)
sudo yum reinstall sudo                   (for Red Hat-based systems)

If the PATH variable has been modified or corrupted, you can restore it to its default value. You can find the default PATH variable for your system in the /etc/environment file and update it accordingly. You added it to the root’s ~/.bashrc:

Vim
1
PATH=$PATH:/usr/sbin

and reload the file with reload command.

So, the “sudo: command not found” error can occur due to various reasons, including misconfigured PATH variable, missing sudo installation, or incorrect file permissions. Usually, it is a small issue. Remember to exercise caution when making changes to system files and configurations, especially when dealing with administrative privileges.

Tagged With chemical1gr
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Fix: sudo: command not found Error

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • WordPress & PHP : Different AdSense Units on Mobile Devices

    Here is How To Serve Different AdSense Units on Mobile Devices on WordPress With PHP. WordPress Has Function Which Can Be Used In Free Way.

  • PHP Snippet to Hide AdSense Unit on WordPress 404 Page

    Here is Easy PHP Snippet to Hide AdSense Unit on WordPress 404 Page to Avoid Policy Violation and Decrease False Impression, False Low CTR.

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

vpsdime

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Cloud-Powered Play: How Streaming Tech is Reshaping Online GamesSeptember 3, 2025
  • How to Use Transcribed Texts for MarketingAugust 14, 2025
  • nRF7002 DK vs ESP32 – A Technical Comparison for Wireless IoT DesignJune 18, 2025
  • Principles of Non-Invasive Blood Glucose Measurement By Near Infrared (NIR)June 11, 2025
  • Continuous Non-Invasive Blood Glucose Measurements: Present Situation (May 2025)May 23, 2025
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2026 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy