this post was submitted on 28 Apr 2025
60 points (96.9% liked)
Linux
53664 readers
1210 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Neither ~/bin or ~/.local/bin are part of most shell's default
$PATH
so you're going to have to modify the user's shell profile (or rc) to include it. It's possible that your favorite distro includes it but not mine. For example(s):or
That was on Fedora. The funny thing is /bin is soft linked to usr/bin, weeeee.
This is on Debian
I'm not sure why you're bringing the XDG or systemd "standard" into this. POSIX standard would be more appropriate but they don't say anything on the matter, nor should they really. The most important thing is, be predictable. If the user has a problem with one of your scripts, what do they do first?
which wolf_bin
will show them the full path to the script. So really, the location does not matter much.That said I would go with one of these two options:
Make a package for your distro. This may be overkill for a couple scripts but you did say they're in a git repository so you could automate it. The package would install to /usr/bin which would require sudo or root. If the scripts are only allowed to be run by one user, set the rwx and group permissions.
A pattern I like, especially for lightweight things such as scripts that don't require compiling or OS management and also are using git; a "hidden" or "dot" directory in the user's home where the repo lives e.g.
~/.lemmywolf/
Then add scripts directory to the user's $PATH e.g.PATH=$PATH:~/.lemmywolf/scripts
. This is what some fairly large projects like pyenv or volta do. You could take it a step farther and modify this installer script to your liking https://github.com/pyenv/pyenv-installer/blob/master/bin/pyenv-installer/edit 20 year Linux user (Redhat AS2.1) and 5 years of Unix (HPUX & Solaris) before that.
/edit2 I just noticed the pyenv-installer does not modify the user's shell profile. That could easily be added to the script though.
Probably because in their "basedir" specification they do recommend
~/.local/bin
to be in$PATH
. I'm sure there's more than one distro following that spec, whether we'd want to consider it standard or not. I also believe there's some software (like flatpak) that may place scripts there too, when configured to offer commands for user-level instalations.Here's a quote from the spec:
a distro package is way overkill for this, and its also better to not litter the home directory with yet anothet dotdir, that's why .local/bin is a good place, also recommended by ~~systemd~~ the freedesktop base directory standard: https://specifications.freedesktop.org/basedir-spec/latest/