MacOS – Commands not found in Terminal except echo

bashmacosterminal

In my terminal basic commands are not found like:

mds-macbook-pro:~ ZILLURRAHMAN$ ls
-bash: ls: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ env
-bash: env: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ edit
-bash: edit: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ open
-bash: open: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ vi
-bash: vi: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ tail
-bash: tail: command not found
mds-macbook-pro:~ ZILLURRAHMAN$ ls
-bash: ls: command not found

But echo is working. Like: mds-macbook-pro:~ ZILLURRAHMAN$ echo $PATH
“users/ZILLURRAHMAN/desktop/bioinformatics/bow-tie/bowtie2-2.2.3/BT2_HOME:??

I can call up programs like pico using their full path like /usr/bin/pico.

Best Answer

The issue is that your PATH is messed up. The reason why echo works is because it is a builtin command in the shell so the shell does not use your path to find the executable.

You need to see what script file had an export PATH in it which set it to “users/ZILLURRAHMAN/desktop/bioinformatics/bow-tie/bowtie2-2.2.3/BT2_HOME:?? which has many error in it.

The usual files are ~/.profile ~/.bashrc or ~/.bash_profile for more see many question on bash