I have an executable. I want to execute the executable in terminal with name only like other commands.
I can put my executable in
/usr/local/bin or I could add its
~/.bashrc. Both will work.
What is better? Is there any difference?
For example let me assume, you have an executable
User level Change
If you add the
But the change will be affected in user level. That means if you have any other user(s) they could not access the executable with name only. If they have proper permission they need to run the executable as,
Also, you will not be able to run the script as sudo as it is not in
system level change
If you put your script in
In that case you can run the executable as
Now choose one way depending upon your need.
Adding the location of the file to your
Why is that? Because, your
If you put the executable file in
If you instead add the directory containing the program to the
Just as a complement to @souravc answer...
For the "User level Change", instead of editing the
The directory will be automatically added to the
Just my 2 cents. :)
PS- I tried to post this as a comment to @souravc answer, but I didn't have enough reputation. :-(