The dreaded No command ‘foo’ found
error can be a bit of a headache to diagnose and solve. As an expert system administrator, I’m often tasked with resolving this issue on Debian systems. This post will take you step-by-step through the issue and its resolution, so let’s dive in.
What Causes the Error?
Whenever you run any command in a shell, the $PATH
environment is consulted to find the specified program. If a program can’t be found, you get a no command ‘foo’ found
error. The $PATH
is a list of directories in which your system searches for executable programs. Typically, the PATH includes only system-wide directories, like /bin
, /usr/bin
and /usr/sbin
.
Solving the Error with SSH
Since the $PATH
environment variables are defined in your interactive shell, they won’t be available when remotely logging into a server via SSH. This means that SSH can’t find the program you’re trying to run, and you get the “No command ‘foo’ found” error.
Fortunately, the solution is simple. All you need to do is specify the path to the desired command when using SSH:
ssh user@server '/path/to/foo'
This will tell SSH exactly where to look for the command foo
, and it will execute accordingly.
Conclusion
I hope this has helped you understand the issue and its resolution. With a little knowledge of the $PATH
environment variables, you can easily troubleshoot the “No command ‘foo’ found” error on Debian systems.