Q. Why I am getting the error Command not found? How do I fix this problem?
A. A common question asked by new Linux or UNIX users. When you get the error "Command not found" it means that Linux or UNIX searched for command everywhere it knew to look and could not find a program by that name. Another cause is you misspelled the command name (typo) or administrator does not at all install the command on your Linux/UNIX system. To get rid of this error:
1) Make sure command was not misspelled:
All Linux and UNIX commands are case sensitive and you type correct spelling of command.
2) Make sure command is your path
You can see current search path with following command:
$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/home/vivekgite/bin
Usually all user commands are in /bin and /usr/bin or /usr/local/bin directories. All your programs are installed in these directories. When you type clear command, you are running /usr/bin/clear. So if it is not in path try to add directories to your search path as follows (setup Linux or UNIX search path with following bash export command):
$ export PATH=$PATH:/bin:/usr/local/bin
You can also find out of path of any command with which or whereis commands:
$ which ls
/bin/ls
$ which gcc
/usr/bin/gcc
$ which date
/bin/date
$ which cal
/usr/bin/cal
$ whereis gcc
/usr/bin/gcc
Remember you can run a program using its full pathname:
$ /bin/ls $ /bin/date
Finally, sometime you may not have permission to run the command.


{ 10 comments… read them below or add one }
Hi,I have a problem when I run the command under Cygwin.
I type
./run.bash
However,it shows:
:command not found
‘/run.bash: line 6: Syntax error near unexpected token ‘
‘/run.bash: line 6: ‘function gplot’
All this code was definitely right, that’s our teacher who give to us..
So what’s the problem?
Thank you
Line 6 has an error. Can you just copy and paste your source code here. Put in
<code>your script code…</code>
tags, so that I can help you further.
the command ’setup’ is not working, it says command not found although there is a man page for that command…can u help me how to make it work or is there any alternate command for the above??
Hi
I have a bash script say “simulate”.
When i type simulate on cmd prompt, it says
command not found. but when i type
./simulate it works.
What can be reason. i checked PATH, /bin is there.
Which bash says /bin/bash.
regards
Sandeep
Sandeep,
Add your home directory to PATH
export PATH=$PATH:/home/you
Hi configure command is not there in my bin folder. So this command is not executing. Pls help me that what i have to do to run this command?
If the $PATH variable is correct a fully qualified path works, try typing “rehash” at the command prompt to update the systems list of valid commands.
the man command is not working
it gives comand not found error.
i get an error as ‘Command not found’ when i use zgrep. can any one help me on this. any command to grep through zip files(i need the filename as output)
hi guys!
i’m new to ns2..could someone please tell me why i keep having “command not found” error messages as follows. What should i doooo??? HELP
zaid@ymax-hw-0006:~/Desktop/ns-allinone-2.32/ns-2.32$ testing.tcl
/home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 4: namtrace-all: command not found
/home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 6: proc: command not found
/home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 7: global: command not found
/home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 8: flush-trace: command not found
/home/zaid/Desktop/ns-allinone-2.32/ns-2.32/testing.tcl: line 9: close: command not found
zaid@ymax-hw-0006:~/Desktop/ns-allinone-2.32/ns-2.32$ Cannot connect to existing nam instance. Starting a new one…
nam: Unable to open the file “out.nam.nam”