63
submitted 1 day ago* (last edited 1 day ago) by wolf@lemmy.zip to c/linux@lemmy.ml

For one user account, I want to have some bash scripts, which of course would be under version control.

The obvious solution is just to put the scripts in a git repository and make ~/bin a symlink to the scripts directory.

Now, it seems on systemd systems ~/.local/bin is supposedly the directory for user scripts.

My question, is mostly, what are the tradeoffs between using ~/bin and ~/.local/bin as directory for my own bash scripts?

One simple scenario I can come up with are 3rd party programs which might modify ~/.local/bin and put their own scripts/starters there, similar to 3rd party applications which put their *.desktop files in ~/.local/applications.

Any advice on this? Is ~/.local/bin safe to use for my scripts or should I stick to the classic ~/bin? Anyone has a better convention?

(Btw.: I am running Debian everywhere, so I do not worry about portability to non systemd Linux systems.)

Solved: Thanks a lot for all the feedback and answering my questions! I'll settle with having my bash scripts somewhere under ~/my_git_monorepo and linking them to ~/.local/bin to stick to the XDG standard.

you are viewing a single comment's thread
view the rest of the comments
[-] AkatsukiLevi@lemmy.world 52 points 1 day ago

I use ~/.local/bin since by linux standard, ~/.local is a user-level /usr/local, which is a override level of /usr

~/bin ends up cluttering the home folder

Mostly this, but also, if you're going to manage many scripts in a system for many users, revision control doesn't help that. Either look at packaging them properly for your distro, or using something Ansible to distribute and manage their versioning on the system to make things easier on yourself.

[-] AkatsukiLevi@lemmy.world 2 points 1 day ago

Me, packaging company software to Alpine Packages so that I can just apk add stuff

Good practice though. It's pretty much a necessity anymore with supply chain attacks becoming such a thing.

[-] AkatsukiLevi@lemmy.world 1 points 32 minutes ago

Can't have supply chain issues if 90% of your stuff isn't just a bunch of Docker containers running inside a Kubernetes mess

Not saying that it doesn't happen on bare metal stuff, but damm, is it a lot more prominent on sources like npm, pip and docker

[-] just_another_person@lemmy.world 1 points 8 minutes ago

Well...I mean the biggest obvious example in recent history is the xz-utils hack. There's probably more like that out in the wild than most want to think about.

load more comments (2 replies)
load more comments (13 replies)
this post was submitted on 28 Apr 2025
63 points (97.0% liked)

Linux

53682 readers
522 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

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 6 years ago
MODERATORS