Where Do You Put Scripts in Linux?

I was recently tooling around techie blogs and came across someone recommending a solution to the problem of snap wanting to update software at all hours of the days regardless of what else was going on and regardless of the available Internet bandwidth.

The author suggested putting the script he had writte in /usr/local/bin so it could be called by name from anywhere while using the console.

I have always made it a practice to put my own scripts that I use basic task automation in my home directory, so his solution caught my attention. I don’t think there is a right answer to the question, but it makes me wonder how many people are accustomed to putting scripts in places like /usr/bin or usr/local/bin.

Console

For my part, my practice of putting scripts in my home directory- even on my laptop where there are no other users- is practical. I like to keep those things in one place and my home directory makes the most sense to me. I tend to forget about things I put other places, so I keep them where I know I will not forget about them.

There are specific cases where I put scripts in other locations, of course. I was recently automating some tasks linked to logrotate, so I wrote a script and dropped it in the place that scripts linked to logrotate go- /etc/logrotate.d/httpd-prerotate. That makes sense to me because it is linked to a specific service that needs scripts in a specific place.

Which sort of goes to my thinking about the question. I think of /usr/local/bin as a place for scripts related to installed packages rather than custom scripts I’ve written for my own little tasks. I have a vpn script, for instance, that automates connecting to a VPN I use sometimes. Should that script go in /usr/local/bin? I guess it could, but since that’s my personal script for my own use, I think of it as belonging rightly in my home directory.

I’m no Linux system programmer, maybe your experience is different than mine.