this post was submitted on 28 Sep 2023
677 points (98.7% liked)

Linux

48256 readers
456 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
top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 145 points 1 year ago* (last edited 1 year ago) (3 children)

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.

[–] [email protected] 89 points 1 year ago* (last edited 1 year ago) (8 children)

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…

[–] [email protected] 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)
[–] [email protected] 24 points 1 year ago (1 children)

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

load more comments (1 replies)
[–] [email protected] 21 points 1 year ago

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

[–] [email protected] 118 points 1 year ago (3 children)

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

[–] [email protected] 28 points 1 year ago* (last edited 1 year ago) (1 children)

You still have sd devices? /s

load more comments (1 replies)
[–] [email protected] 26 points 1 year ago (2 children)

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

[–] [email protected] 19 points 1 year ago (4 children)

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)
[–] [email protected] 98 points 1 year ago (5 children)

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.

[–] [email protected] 57 points 1 year ago (6 children)

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.

[–] [email protected] 23 points 1 year ago (3 children)

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)
[–] [email protected] 19 points 1 year ago (4 children)

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)
load more comments (3 replies)
[–] [email protected] 82 points 1 year ago (2 children)

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. 😒

[–] [email protected] 38 points 1 year ago (3 children)

~/go is one of my major pet peeves.

[–] [email protected] 24 points 1 year ago (1 children)

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)
[–] [email protected] 78 points 1 year ago (17 children)

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)
[–] [email protected] 64 points 1 year ago (1 children)

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

[–] [email protected] 73 points 1 year ago* (last edited 1 year ago) (5 children)

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
[–] [email protected] 29 points 1 year ago

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

[–] [email protected] 16 points 1 year ago* (last edited 1 year ago) (3 children)

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)
[–] [email protected] 14 points 1 year ago (1 children)

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)
[–] [email protected] 44 points 1 year ago* (last edited 1 year ago) (3 children)

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

[–] [email protected] 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)

[–] [email protected] 14 points 1 year ago (2 children)

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)
[–] [email protected] 33 points 1 year ago (2 children)

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)
[–] [email protected] 32 points 1 year ago (5 children)

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.

[–] [email protected] 41 points 1 year ago* (last edited 1 year ago) (2 children)

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)

[–] [email protected] 12 points 1 year ago (2 children)

And maybe could still get them with testdisk 😁

load more comments (2 replies)
load more comments (1 replies)
[–] [email protected] 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)
[–] [email protected] 25 points 1 year ago (12 children)

Me staring aggressively at Steam, Zotero, and bash:

(And more)

[–] [email protected] 15 points 1 year ago (1 children)

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

load more comments (1 replies)
load more comments (11 replies)
[–] [email protected] 24 points 1 year ago* (last edited 1 year ago) (1 children)

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)
[–] [email protected] 24 points 1 year ago (8 children)

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

load more comments (8 replies)
[–] [email protected] 21 points 1 year ago (1 children)

My $HOME is my castle (・へ・)

load more comments (1 replies)
[–] [email protected] 18 points 1 year ago* (last edited 1 year ago) (3 children)

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)
[–] [email protected] 15 points 1 year ago
[–] [email protected] 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.

[–] [email protected] 14 points 1 year ago

Yes please!

[–] [email protected] 12 points 1 year ago

Someone should pass this on to valve.

[–] [email protected] 12 points 1 year ago

A user may want to back it up as an important part of their system, control it’s permissions,

control its* permissions

load more comments
view more: next ›