The dreaded moment when you are on your Unix / Linux server and you type ‘ls‘ and up pops ‘Command not found‘.
Before running about screaming, asking yourself why did you run that last command.
Check your PATH
$ echo $PATH
If yours is not showing /bin , /usr/bin or /usr/local/bin directories, then this is why you are getting ‘Command not found‘ these are the directories that hold the systems user commands.
So, you’ll need to add them back into the PATH
Now try the ‘ls‘ command again. It should now work.
If you want to change it later, do
That way it will keep the existing PATH and add the new directory to the end.
If you need to add the above so it is available at startup, you need to Google your “(OS) add path to startup” or “(OS) add path to profile“, there is too much and too many OS variations on this topic to be covered here.