Home Craft command not found” Error on Linux

command not found” Error on Linux

by Staff
0 comment

Sometimes, when you try to run a command as the root user using sudo, you receive a “command not found” error. Here’s how to fix it.

When setting up a new Linux desktop or virtual machine, you may encounter the error: “sudo: command not found”. This Linux error message can be infuriating, and prevent you from progressing further with your setup. Here’s what it means and how to fix it.

What Is “sudo” in Linux?

User accounts on Linux come with a limited set of privileges that prevent them from performing administrative tasks which may damage the system. These limited privileges may keep users from accessing certain areas of the filesystem or from executing certain files.

The one user who has no such restrictions on their actions is the root user. The root user can access any area of a Linux system, and execute any command on any file.

Because of this immense power, you should disable the root account and use sudo instead.

The sudo command is short for “superuser do” and allows a user who is part of the sudo group to execute a command as if they were the root user. It effectively gives them root powers and permissions—as long as they use sudo and authenticate with a password.

Why Is the sudo Command Not Found?

As well as being a useful command, sudo is a package. On most systems, sudo is installed by default. But this is not the case on all distros, and when you attempt to run a command using sudo you may receive the error, “sudo: command not found”. This is especially common on newly installed Linux systems.

You may then try to install the sudo package with:

sudo apt install sudo

This will fail because you are unable to use sudo to install packages as the root user.

How to Fix “sudo: command not found” on Linux

As your user cannot assume the privileges of the root user without already having sudo installed, you need to log out of your user account and log in as root.

As root, you can install the sudo package with the privileges this account possesses.

On Debian-based systems, enter:

apt install sudo

Then, add your user to the sudo group using:

usermod -aG sudo your_username

On Arch-based systems, enter:

pacman -S sudo


usermod -aG wheel your_username

You Can Now Run Commands With sudo on Linux!

You have successfully installed sudo and added your user to the sudo group, meaning that you can run any command and access any area without needing to log in as root. Use this power carefully, as elevated privileges can be dangerous.

Read the full article here

You may also like

Leave a Comment

Iman Hearts is one of the biggest lifestyle news and articles portals, we provide the latest news and articles about family, lifestyle, entertainment, and many more, follow us to get the latest news about what matters to you.


© 2022 Iman Hearts. All rights reserved. Sitemap