Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a few shell scripts written in bash & was moving them to a new server and I was wondering if it makes any difference where I add them? Is there a specific directory where one "generally" places scripts that are run via cron?
Obviously in crontab, I add the full path of the script but I want to know if there is a general rule of thumb as to where it is safe to place scripts.
Generally you place all you're personal scripts in your home directories bin folder (~/bin) if it has one.
No, my users home directory is empty minus hidden files. I generally also don't run the scripts as a specific user but as root so I would basically just be throwing them in my home directory, right?
If you are the system admin, /usr/local/bin or /usr/local/sbin would seem to be good places. If you are not an admin, a sub-directory called "bin" under your HOME directory is quite common.
Another location is /opt/bin or /opt/packagename/bin where "packagename" is the name of some app or other.
See the Linux FHS for fully descriptions of these directories.
If you are the system admin, /usr/local/bin or /usr/local/sbin would seem to be good places. If you are not an admin, a sub-directory called "bin" under your HOME directory is quite common.
Another location is /opt/bin or /opt/packagename/bin where "packagename" is the name of some app or other.
See the Linux FHS for fully descriptions of these directories.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.