Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk4 min

How to Find and Fix a Linux Command That’s Missing or Not on Your PATH

Use Bash’s type and hash commands to tell whether a Linux tool is missing, outside PATH or remembered at an old location—and choose the right fix.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Bash, start with type -a tool and type -P tool, then inspect $PATH and check whether the executable exists and can run. If it exists outside the directories in PATH, call it by pathname or add its trusted directory to the right shell’s PATH. If it is absent, find and install the distribution package that provides it. If the command was recently moved or removed, check Bash’s remembered location with hash -t tool and refresh it with hash -r.

What “command not found” can mean

For a command name with no slash, Bash first checks for a function and then a builtin; it then searches the directories in PATH for an executable. Bash may also use a remembered command location. A name containing a slash, such as ./tool or /opt/tool/bin/tool, is treated as a pathname rather than searched through PATH. See the Bash Reference Manual’s command search and execution rules.

As an Amazon Associate I earn from qualifying purchases.

If the search fails and no command_not_found_handle function is defined, Bash reports an error and returns status 127. Some distributions or shell setups customize the error display, so the wording alone does not establish whether a program is uninstalled or merely outside PATH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check how Bash resolves the name

Replace tool below with the command you tried:

printf '%sn' "$SHELL"
type -a tool
type -P tool

type -a lists the ways and locations Bash can resolve the name, including aliases, keywords, functions, builtins, and files. type -P forces a search for executable files in PATH. These options are documented in the Bash builtins manual.

$SHELL often identifies your login shell, not necessarily the shell currently interpreting the command. If you are troubleshooting a script, terminal, or application-launched session, check which shell actually runs it and use that shell’s own lookup commands and documentation. This procedure is specifically for Bash.

Inspect PATH and check the executable

Print the current shell’s search list:

printf '%sn' "$PATH"

PATH is a colon-separated list of directories Bash searches for command names. Check whether the expected executable is in one of those directories. If you know a likely installation location, inspect the exact file and try it by pathname:

ls -l /likely/directory/tool
/likely/directory/tool --version

If the pathname works but bare tool does not, the issue points to command resolution or PATH. If the pathname itself fails, read the error before changing the search list: permissions or an invalid executable or interpreter can cause failures unrelated to PATH.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fix PATH when the executable already exists

Run it once by pathname

For a one-time invocation, use the full pathname, for example /opt/tool/bin/tool --version. This avoids changing shell configuration.

Test a temporary PATH change

To make the executable discoverable by name in the current shell, prepend its known, trusted directory while preserving the existing list:

PATH="/known/tool-directory:$PATH"
export PATH

Then try tool again. Avoid replacing PATH with only the new directory; doing so can make standard commands unavailable. An empty element in PATH has shell-specific implications, including possible current-directory lookup, so do not add one casually.

Make the change persistent only in the right startup file

For a persistent change, put the assignment in the startup file read by the shell and session that need it. There is no single universal file: the right choice depends on the shell, whether it is interactive or a login shell, and how it was started. Add only a directory you trust, and verify the result in the same kind of session where the command failed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install the program if its executable is absent

If you cannot find an executable at the expected location, identify your Linux distribution and use its official package search or package documentation to find which package provides the command. Package names can differ from executable names, so do not assume that a package has the same name as the command. Install it through the system’s normal package manager and follow local administrator policy. The exact package and installation command depend on the distribution.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Refresh Bash’s remembered command location

Bash can remember full command pathnames to avoid repeating a search. If a command was moved, upgraded, or removed while the shell remained open, inspect its remembered location and clear the cache:

hash -t tool
hash -r

hash -t tool displays the remembered pathname if one is recorded; hash -r clears remembered locations so Bash can search again. Assigning a new PATH in Bash also clears the hashed filenames. See the Bash manual’s hash builtin documentation.

Choose the fix based on what you found

Finding Next step
The executable exists and its pathname runs, but its directory is not in the current PATH. Use the pathname for a one-off run, or add the trusted directory to the relevant shell’s PATH.
No executable is present at the locations you checked. Use your distribution’s official package information to identify and install the provider package.
The command used to work, but its location may have changed during this shell session. Check hash -t tool, then run hash -r to clear Bash’s remembered locations.
The pathname exists, but running it fails. Investigate the specific error, including permissions or an invalid executable or interpreter; changing PATH will not fix those issues.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.