Command Not Found Errors

To execute a UNIX command, utility, or shell script, simply type the command name at the shell prompt, including any options and arguments needed by the command. Some commands are built into the shell program, but most standard UNIX commands are program files stored in directories such as /bin, /usr/bin/, /etc/, /usr/local/bin, /sbin, and so on.

If you try to run a command, you might get an error like this:

$ myscript
myscript: not found
$ ./myscript
acme
pegasus
$

It’s common to see this not found error when you first begin writing your own shell scripts. If the script is in your current directory, run the file as ./scriptname. This might solve the problem.

If you still get a command not found error, check that you have ...

Get Practical UNIX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.