How to Fix the “command not found” Error on Linux
If you’re a Linux user, you’ve most likely encountered the “command not found” error on the Linux terminal.
Often when you come across this error, you’ll get a suggestion to install a program, however, there are several potential causes for the “command not found” error.

Understanding Environment Variables and Case Sensitivity
Before we go about fixing common causes of the error, it is important to appreciate a few critical properties of Linux commands.
Unlike Windows, all commands, filenames, and directories on Linux and Unix systems are case-sensitive. This means that all commands and their corresponding arguments or options should appear exactly as they are meant to. Of course, most commands are lowercase.

Environment variables play an important role in Linux. They contain valuable information about your login session and other important details.
When you run a command on Linux, your system will search in your current variables, specifically the PATH variable, to find the command or program that you want to run. If the command is not found, you’ll get an error that it’s not found.

With this understanding, here’s how you can troubleshoot the “command not found” error on Linux.
1. Check for Syntax Errors
You should run all Linux commands exactly as they appear case-wise. For example, the shell treats “ls” and “LS” as different commands on Linux.
Also, if your command contains arguments, make sure you’re using the correct case. The ssh command for port forwarding takes the format:

The “L” and the “N” arguments, in this case, must be uppercase, otherwise, you’ll get an error.
In some cases, the options or arguments may require a preceding hyphen (-) or double hyphen (–), and some arguments may need to be enclosed in quotes or brackets.

confirm you are using the correct command. Double-check the spelling of the command you are trying to use and ensure that you are using the correct case.
2. Include the Path to Your Executable
Scripts play a vital role in Linux as they allow you to automate mundane tasks. If youwrite your own Bash programor use some third-party programs, you’ll need to specify the entire path to the program to execute it successfully.
When you download the Open Virtualization Format Tool, for example, you can install it to any directory of your liking. Now, when you try to run theovftoolcommand from a directory other than the one it was installed in, you’ll get the “command not found” error.
To run the command properly, you need to specify the entire path to the program executable. If, for instance, you’ve installed ovftool in the/opt/ovfdirectory, then to runovftool, you’ll have to use the following command:
Also, pay attention to the slashes. Unlike Windows, which uses backward slashes, Linux uses forward slashes. Use theTabauto-completion feature of your terminal to avoid typos in directory names.
3. Use Environment Variables
If you find that specifying an entire directory to a command is tiresome, consider adding the program executable to your PATH environment variable.
To add a program executable to PATH, simply run a command in the following format:
For example, to add the Microsoft .NET tools program to your PATH, run the command:
Environment variables are written to the~/.bashrcfile on Bash or the~/.zshrcfile if you’re using the Z shell.
To update and apply the changes you’ve made to the~/.bashrcfile without logging out, run the source command as follows:
it’s possible to check if your program path is successfully added to the PATH variable using the command:
4. Make Sure That the Program Is Installed
Sometimes, the cause of the “command not found” error could simply be because the program is not even installed in the first place.
If the command you are trying to run is nota built-in shell command, it may be that the program is not installed on your system. In this case, you will need to install the program or the package that contains it.
Depending on your distro, use the default package manager to install the required software. On Debian-based distros,use the apt command, and use DNF or YUMon RHEL-based distros.
5. Use the Correct Privileges
If you are very certain that the program or command you’re trying to run is on your system, and you are using the correct syntax then it could be an issue with the permissions.
Similar to Windows, you’ll need elevated privileges to execute certain programs on Linux. If that’s the case, confirm that you’re using sudo or running the program as the root user.
Make Use of Environment Variables on Linux
Ensure you use the correct syntax when executing Linux commands and consider adding the programs that you often run to your environment variables.
Environment variables play such an important role in Linux that understanding them is key for your day-to-day use of the operating system.
Set custom preferences and default applications on Linux by creating and configuring environment variables.
Don’t let aging hardware force you into buying expensive upgrades.
When your rival has to bail out your assistant.
Windows is great, but adding this makes it unstoppable.
These are the best free movies I found on Tubi, but there are heaps more for you to search through.
So much time invested, and for what?