I have an executable file "x" stored in a directory. I want to be able to execute program "x" by typing "x" from anywhere in terminal. Currently I have to be in the programs directory and type "./x" to run the program. How can I fix this?
Within your home directory you should see a file called .profile
Open this file and edit it to add the following
Save the file and restart your terminal window.
now that you have added the folder containing your custom executable to the path you should be able to type "x" and run the command.
WARNING: be careful when changing your path. if you make a typo your system will not be happy
EDIT: if you don't have a .profile file in your home directory bash typically looks for profile information in the following order