TransWikia.com

Storing Scripts vs Storing Symbolic Links in /usr/local/bin

Ask Ubuntu Asked by Alex.Kh on December 20, 2020

I have a bunch of scripts that I use on a regular basis. I am storing them in a folder on my disk(not in the $PATH),so I had to manually execute them from that folder. I (finally) decided to make my life easier and move all of my scripts into the /usr/local/bin. The question is, should I move my files directly, or should I simply create symbolic links pointing to the files? Is there are any caveats I have to keep in mind while making a decision?

One Answer

Whether you store the executable themselves or a symbolic link to them in /usr/local/bin is essentially just a matter of your personal preference. If it were me, I would probably work with symbolic links to the actual files in a folder under my Documents folder. That way, 1) I would be able to edit them without needing to be root, and 2) they would be safeguarded anytime along with my backup of the Documents folder.

If you are the only one using your scripts, it may be more convenient to store your scripts in ~/.local/share/bin or in ~/bin in your home folder. In Ubuntu, both of these folders are automatically added to your PATH if they exist. Advantages: 1) you do not need to be root to change/update scripts 2) you are the only user having access to them.

If other users need also access to the scripts, /usr/local/bin is the perfect location for that. That folder is not used/managed by the operating system. It is specifically there for your custom home made scripts.

Using these folders prevents the need of having to change the PATH environment yourself.

Correct answer by vanadium on December 20, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP