673
submitted 1 year ago by American_Jesus@lemm.ee to c/linux@lemmy.ml
top 50 comments
sorted by: hot top controversial new old
[-] 6xpipe_@lemmy.world 143 points 1 year ago* (last edited 1 year ago)

XDG gang, rise up!

Also, I know that this community and dot-files in general are Unix based, but this holds true for Windows development as well. You should be putting app files in the users' %APPDATA% directory, not their user folder. It's probably even more important since Windows doesn't autohide dot files.

[-] fartsparkles@sh.itjust.works 88 points 1 year ago* (last edited 1 year ago)

The My Documents / Documents folder on Windows is a dumping ground for game saves and random applications. I no longer use it for saving my documents anymore…

[-] pennomi@lemmy.world 27 points 1 year ago

Yep, my ~/Projects folder is where I keep anything I need to actually find. All the normal places are full of random cruft.

load more comments (7 replies)
[-] thesmokingman@programming.dev 24 points 1 year ago

One of my proudest accomplishments is contributing to the XDG Base Dir spec. I fixed a typo.

load more comments (1 replies)
[-] Zeth0s@lemmy.world 21 points 1 year ago

Unfortunately not even Microsoft does that... On windows having a logical order is a lost battle

[-] gnutrino@programming.dev 115 points 1 year ago

I just write my config files directly to random unused blocks on /dev/sda, filesystems are overrated.

[-] PseudoSpock@lemmy.dbzer0.com 28 points 1 year ago* (last edited 1 year ago)

You still have sd devices? /s

load more comments (1 replies)
[-] chaorace@lemmy.sdf.org 26 points 1 year ago

Nah, dump em' to /tmp/ and let the user figure out the rest

[-] hperrin@lemmy.world 19 points 1 year ago

I just leave all config in memory. If the user really cared, they would never reboot.

load more comments (4 replies)
load more comments (1 replies)
load more comments (1 replies)
[-] AKADAP@lemmy.ml 98 points 1 year ago

I absolutely despise the following directories: Documents, Music, Pictures, Public, Templates, Videos. Why? Because applications randomly dump stuff into these directories and fill them with junk files. I don't want any application putting anything into directories I actually use, unless I explicitly tell them to. It is not possible to keep your files organized if applications randomly dump trash files into them.

[-] herr@lemmy.world 56 points 1 year ago

Same shit happens on Windows. Games will just install their shit literally all over OS with no rhyme or reason to it.

Why can't the save game and config.ini just be in the main god damn game directory? Nobody knows.

[-] jasondj@ttrpg.network 23 points 1 year ago

Actual reason is system permissions.

Most the default installation path is Program Files. That needs elevation to write to. Fine when you’re installing something, but not something you want to need just to run the game.

Writing to %APPDATA% or really anywhere in %USERHOME% is guaranteed to have the right permissions for this user.

Granted, a lot of home PCs and gaming PCs are single-user environments. The “personal” computer. In that case there’s no reason games and applications can’t be installed in %LOCALAPPADATA%, and in fact, I think windows has an environment variable or registry setting for that.

It’s no different in Linux. You don’t want users writing to /etc. And you may expect multiple users. So all of that stuff goes to dot files in $HOME.

load more comments (3 replies)
[-] lloram239@feddit.de 21 points 1 year ago

Why can’t the save game and config.ini just be in the main god damn game directory?

You'd lose all save games every time you uninstall the game. We already had that in DOS/Win9x days and I am very happy that we moved away from this. Static program data and generated data should be clearly separated.

In Linux we have the XDG Base Directory spec for that, that gives you directories for cache, config, state and data, so everything is nicely separated. The only problem is that not every app follows it, bug reports can help.

I find Android handles this by far the worst. They have the core right idea with permissions that makes it impossible for games to write outside of their assigned directories, but the way they handle it your savegames go into an area that will be deleted when you uninstall the app. So the risk of losing savegames is extremely high. The alternative is that games require SD card permissions and than just write wherever they want. It's basically all just a dark pattern to force games into using the Google Play service for cloud saves. Games that lose state and restart when you switch apps are also great.

load more comments (1 replies)
[-] AdmiralShat@programming.dev 19 points 1 year ago

Microsoft OWNS not just gaming companies, but one of the largest gaming hardware companies and many of the largest game developers.

You'd think by now we'd get a dedicated Saves folder to organize this shit after this long.

load more comments (4 replies)
load more comments (3 replies)
[-] lloram239@feddit.de 14 points 1 year ago

I absolutely despise the following directories: Documents, Music, Pictures, Public, Templates, Videos.

Change them: https://wiki.archlinux.org/title/XDG_user_directories

[-] Chewy7324@discuss.tchncs.de 17 points 1 year ago

The apps dumping files into foldes like Documents usually don't care about the XDG_user_directories spec, iirc.

load more comments (3 replies)
[-] nyan@lemmy.cafe 80 points 1 year ago

Y'know what's worse? When there's no dot. Worse than that, it's an undotted directory used to store a single config file. Ugh, unpleasant memories. 😒

[-] pivot_root@lemmy.world 38 points 1 year ago

~/go is one of my major pet peeves.

[-] joyjoy@lemm.ee 24 points 1 year ago

That's not the only folder go creates. There's also ~/sdks/go1.xy

load more comments (1 replies)
load more comments (2 replies)
load more comments (1 replies)
[-] ouch@lemmy.world 78 points 1 year ago

If you care, please take time to upvote or file bugs on packages that don't follow XDG. Or even better, make PRs.

load more comments (17 replies)
[-] Gleddified@lemmy.ca 64 points 1 year ago

One of my greatest pet peeves is random folders appearing in my home folder. Thanks for this

[-] joyjoy@lemm.ee 73 points 1 year ago* (last edited 1 year ago)

Let's count them. (not including legacy or standard locations like .local, .config, or .cache, .ssh, and shell configuration files

  • .aws
  • .azure
  • .bun
  • .byobu
  • .cargo
  • .dbus
  • .docker
  • .dokku
  • .keychain
  • .kube
  • .minikube
  • .motd_shown
  • .node_repl_history
  • .npm
  • .nuxt
  • .nuxtrc
  • .nvm
  • .oh-my-zsh
  • .pack
  • .psql_history
  • .pyenv
  • .python_history
  • .redhat
  • .ruff_cache
  • .rustup
  • .selected_editor
  • .sqlite_history
  • .sudo_as_admin_successful
  • .tmux.conf
  • .tox
  • .ts_node_repl_history
  • .vim
  • .viminfo
  • .vimrc
  • .vscode-server
  • .wget-hsts
  • .yarn

And a couple more, non-hidden files for Go.

  • go
  • sdk/go1.20
[-] darcy@sh.itjust.works 29 points 1 year ago

i can almost ignore the hidden ones, but ~/go? no thats just rude

[-] waspentalive@beehaw.org 16 points 1 year ago* (last edited 1 year ago)

Why aren't all of these just normal directories under either .local (for data files) or .config (for configuration)???

Actually, I think the XDG directories should be under a single XDG directory either dotted or not (a better name would be OK with me) ~/xdg/Documents, ~/xdg/Music, ~/xdg/Pictures etc.

load more comments (3 replies)
[-] darcy@sh.itjust.works 14 points 1 year ago

afaik, tmux can use ~/.config/tmux/tmux.conf or something, if ~/.tmux is not found

load more comments (1 replies)
load more comments (2 replies)
[-] tal@kbin.social 45 points 1 year ago* (last edited 1 year ago)

They may not want their configuration stored in $HOME, for example:

they’re on a machine that isn’t under their physical control and ~/.config is mounted over the network from their personal machine;

That sounds like it's a bad way to handle configuration, since among many other problems, it won't work with the many programs that do have dotfiles in home directory, but even if that happened, you could just symlink it.

they prefer to version control their configuration files using git, with a configuration directory managed over different branches;

I do that. I symlink that config into a git-controlled directory. If OP plans to put his entire ~/.config in git, he is doing things wrong, because some of that needs to be machine-local.

the user simply wants to have a clean and consistent $HOME directory and filesystem

If whatever program you are using to view your home directory cannot hide those files, it is broken, as it does not work with a whole lot of existing software.

less secure,

If your home directory is "not secure", you're probably in trouble already.

Like, there are reasons you may not want to put dotfiles in a homedir, but none of the arguments in the article are them.

EDIT: I will ask developers to stop dumping directories and files that don't start with a dot in people's home directories, though. I gave up over twenty years ago and put my actual stuff under ~/m just to keep it from being polluted with all the other things that dump non-dotfiles/-dotdirs in a home directory. Looking at my current system, I have:

  • A number of directories containing video game saves and configuration. I am pretty sure that these are mostly bad Windows ports or possibly Windows programs under WINE that just dump stuff into a user's home directory there (not even good on Windows). Some are Windows Steam games.

  • WINE apparently has decided that it's a good idea to default to sticking the Windows home directory and all of its directories in there.

  • Apparently some webcam software that I used at one point.

  • A few logfiles

[-] PlexSheep@feddit.de 21 points 1 year ago

I agree with most of your points, but I still think putting configs in the xdg dir instead of putting tons of dotfiles in $HOME is good practice.

I find dotfiles to be that stuff that I want to edit easily, and xdg stuff to be that stuff that I don't edit frequently (manually at least)

[-] rockstarmode@lemmy.world 14 points 1 year ago

I agree with most of your points. Just wanted to add that I use Git + GNU Stow to manage this exact situation and it works flawlessly.

load more comments (2 replies)
load more comments (1 replies)
[-] natecox@programming.dev 33 points 1 year ago

The rust library mentioned there doesn’t support system install paths for windows or macOS, it only uses XDG. I recommend the directories crate which properly supports Linux, Mac, and Windows.

https://github.com/dirs-dev/directories-rs

load more comments (2 replies)
[-] guckfoogle@sh.itjust.works 32 points 1 year ago

You might wanna backup your dotfiles somewhere remote too. I literally lost dotfiles that I'd been building up for years because I couldn't remember the password to my Linux machine after coming back from vacation. Funny enough though, a couple hours after nuking my OS I magically remember my password.

[-] pitbuster@lemmy.ml 41 points 1 year ago* (last edited 1 year ago)

Unless you disk was encrypted, you could have booted up a live distro and back up the files you needed (or even overwrite the shadow file to get a new password)

[-] mvirts@lemmy.world 12 points 1 year ago

And maybe could still get them with testdisk 😁

load more comments (2 replies)
load more comments (1 replies)
[-] conc@lemmy.ml 19 points 1 year ago

After two years of typing in the same boot pass on my same laptop at my same job I woke up one day and couldn't remember it. Almost died trying. Right as I was reaching out to my admin it came to me.

load more comments (3 replies)
[-] JetpackJackson@feddit.de 25 points 1 year ago

Me staring aggressively at Steam, Zotero, and bash:

(And more)

[-] loutr@sh.itjust.works 15 points 1 year ago

To be fair, bash was released a decade before the XDG specs.

load more comments (1 replies)
load more comments (11 replies)
[-] herr@lemmy.world 24 points 1 year ago* (last edited 1 year ago)

And wtf is with anaconda3 just permanently changing your "user@machine" terminal prompt?? Who thought that was a good idea?

load more comments (1 replies)
[-] sickday@kbin.social 24 points 1 year ago

Nix and Home Manager have been my go-to for managing dotfiles and symlinks in my home dir

load more comments (8 replies)
[-] Blizzard@lemmy.zip 21 points 1 year ago

My $HOME is my castle (・へ・)

load more comments (1 replies)
[-] Urist@lemmy.ml 18 points 1 year ago* (last edited 1 year ago)

Tangentially related: I recently learned that there are tools for handling dotfiles such as chezmoi and yadm. I would suppose that after spending some time on backing up the dotfiles that matter one can purge the remainders without much issue. I also remember some tool that was made for the purpose of cleaning $HOME, but can not recall its name (if anyone knows please let me know).

load more comments (3 replies)
[-] TankieTanuki@hexbear.net 15 points 1 year ago

I hate it when an application puts its configuration data in its own dotfile under $HOME instead in ~/.config. Also hate it when caches are stored in ~/.config, because then I have to manually tag those subdirectories for exclusion before doing a backup.

[-] JoMomma@lemm.ee 15 points 1 year ago
[-] RandomLegend@lemmy.dbzer0.com 14 points 1 year ago

Yes please!

[-] xXthrowawayXx@hexbear.net 12 points 1 year ago

Also if the normal invocation of your program produces more than 3k lines of stdout, sanitize it and default to a file.

[-] Infiltrated_ad8271@kbin.social 12 points 1 year ago

Someone should pass this on to valve.

load more comments
view more: next ›
this post was submitted on 28 Sep 2023
673 points (98.7% liked)

Linux

47998 readers
957 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 5 years ago
MODERATORS