If you are a Linux user, then you might encounter an error message which says Sudo command not found. You need administrator access to use the Sudo command. Mainly, the problem appears in the Ubuntu Operating System. By default, if this Operating System crashes out of the root account, then you need to use Sudo. This does not include any distribution of Linux. Also, it does not include any version of BSD OS.
If there is an error in GNU/Linux, you will get this error. This is a very typical error. You need to fix the issue as early as possible. To do that you need a proper guideline. Here, in this guide, we will provide you with the best methods to resolve the issue instantly.
Troubleshooting Methods to Fix Sudo Command not Found Issue
Some of the effective ways you can use to fix the issue Sudo command not found immediately are described in this section. Hence, try the methods below to overcome these glitches without wasting too much time.
Fix 1: Fix the Issue Sudo: Apt-Get: Command not found on GNU/Linux
Linux distribution does not come with Sudo. But when you type “sudo fdisk -I” or something like that and execute the command, you will get the issue. It mostly depends on what shell you are using. Whether it is bash or Almquist. Therefore, you need to log in as the root user in order to get rid of this situation.
But, if you do not have Sudo on your device, then you cannot begin the process. Hence, to switch to a virtual terminal press and hold the Ctrl + Alt and F1 or F2, depending upon the System Settings option. After that, type “root” and hit the Enter button. Now, insert the password for the original root user and press the Enter button again. Then, you will get an “#” symbol for the Command Prompt option.
If you have a system which is based on the “apt package manager”, type “apt-get install sudo” and hit the Enter button. Those who have used a different system such as the yum RPM system can use ‘yum install sudo package management command’. Wait for the installation process and agree to the confirmation box.
After that, from the root prompt, you need to type “visudo” and press the Enter button. Then, you will get a vi-editor screen. At the bottom of the file, you need to enter the username which is “ALL=(ALL)ALL”. Keep in mind that, all the characters are in a small letter.
If you work with the “vi”, then press the Esc button and then type “ wq” to exit from the window. If you are using GNU, then you need to hold down the Ctrl + O at the same time and then Ctrl + X to exit from the window.
Now, check whether the problem “sudo: apt-get: command not found” gets resolved or not. As we all know that BCD problem is hard enough to eradicate. So, you can go for the alternative method listed below.
Fix 2: Sudo Command not Found on Free BSD and other Unices
BCD operating system mainly comes with Sudo. It never comes with the actual Sudo command. To perform the action, you need to log out of your account. After that, type “root” as the username and then enter the password. Hit the Enter button to log in to your account.
You need to stay in the prompt window, it mainly indicates that you are running the program as a privileged user. After that, you need to add the binary package for Sudo. Then, type “pkg_add-rv sudo” and press the Enter button. Now, install it and wait until the installation process gets completed. Once it’s done, type “visudo” and hit the Enter button. At the end of the file, you need to add the following line: billy ALL = (ALL) ALL.
You need to replace billy with the actual username. If visudo is actually used as a “vi” then press the Esc button and then type “wq” to exit from that window. Finally, you should log out of your account and then Sudo will open normally.
In the above article, we have discussed two methods in order to overcome the typical error “sudo command not found”. Moreover, we have tried to define all the steps clearly. So, we hope this content is helpful to fix the issue from your Linux device. Furthermore, if you have any queries regarding this, or want to provide any feedback, then post them in the comment section which is given below.