Live data from Hacker News

Tips on how to structure your home directory (2023)

unixdigest.com

151–160 of 172 posts

Re: Tips on how to structure your home directory (2023)

#152
post #35

I hate having a polluted home directory, especially when an application thinks it should get a non hidden directory in my home! The one that upsets me the most is the default directory for go modules `~/go`. This frustrates me so much. I refused to install any go apps or use it for development for years. I've unfortunately had to give in, and it can at least be overridden by setting `GOPATH`, but it is a terrible, te…

Same thing, wish that from the start unix had some standardized "applications put everything they want here" home directory that's separate from the "here user chooses to put their own files" home directory

At the start, unix commands didn't need or use configuration files. The world really was that simple, for a while. Now we have even simple desktop apps, that I have not changed a single setting in, insisting to write a whole directory tree of whatever data in my home.

Or absolutely moronic things like ~/.config/VSCod*/*Cache* -- really, cache in config?

Re: Tips on how to structure your home directory (2023)

#153

Earlier quoted context omitted.

I do something similar for relevant folders, where I organize by time. I have a top level dir where I usually have what I'm working on at the moment - think "this day" or "this week". When it's time to archive it, outside that time window, I created a folder, using this format, for example for today: 041924 I move all the files I created on that day into there. As a person with a typical human lifespan, I see no need…

> 041924 I can accept YY instead of YYYY, but surely YYMMDD is preferable due to sort order.

The advantage of 041924 is that, when changing directories from the terminal, you can type 0419 and tab the rest of the way (99% of the time the only completion is 24). It's more efficient. If I prepended the year, I'd have to type out 240419 every time.

Re: Tips on how to structure your home directory (2023)

#154
Most of both this article and the discussion is covering the simple case of home on a local hard drive, rather than the more interesting real-world situations with network-mounted home directories and multiple different HW/OS architectures you'd want to be able to have handled transparently. Which is fine.

For more... interesting network scenarios, it can be helpful to construct some variable, say, $HOSTABI, that includes tokens for both hardware and OS.

$ echo $HOSTABI x86_64-ubu-2204

Which can then be used inside architecture-influenced variables like ARCH, LIBRARY_PATH / LD_LIBRARY_PATH, PATH, as well as inside the user's own installation system (makefiles, etc) used for anything the user compiled. Great for just installing some new hw/sw combo, mount home, cd into "~/src" or equivalent and run "make install", and just get all your own code recompiled and installed for your new architecture.

This is a microcosm of what sysadmins on heterogeneous networks do, mostly for different hardware architectures, although this was a much more common situation in earlier years than more recently where Linux has taken over even more of the corporate/research world. I've found it pretty useful even at home, where I'm using my one home directory across my systems' different installations of Linux with different library requirements (although I should probably sell that SGI Onyx/RE - IRIX not Linux - that Wing Commander III was rendered on).

My home directory is usually populated almost exclusively with dotfiles and some threescore subdirs with 3ish-letter names like doc/ etc/ fun/ (I'm a gamer) git/ iso/ job// lib/ man/ pub/ (packages of my own programs) sbin/ src/ steam/ (yep) tmp/ var/ (notes, logs, etc) vr/ ... and so on.

It seems to work out alright. Contains about half a million subdirs and 4.2 million files. ;-)

Re: Tips on how to structure your home directory (2023)

#155
post #112

Earlier quoted context omitted.

> My experience with metadata is that a lot of applications don't care about its integrity [...] This has led me to formally maintaining significant metadata in the filename, for certain kinds of files; everything else gets lost or diverges. For instance, a book file might be named `Title [a=Jim Smith; isbn=9781234567890].pdf`.

I feel like you're probably kidding, but I kind of like this. Maybe not psyched about the shell-interpreted brackets, semicolons, and spaces. But the idea is interesting!

No, I'm serious. There's no portable filesystem metadata, and while a few kinds of media files have facilities for internal metadata (e.g. EXIF and ID3), most don't. A file name is the only non-content that is easy to keep associated with any kind of file.

The syntax is definitely an imperfect compromise, but most of the things I use this for have titles that frequently contain spaces (books, papers, music, etc.) so quoting would be necessary anyway, and I made myself a Python package to help with escaping and do other utility tasks like normalizing ISBNs.

Re: Tips on how to structure your home directory (2023)

#156
I'm shifting towards simply "not having" a home directory. Actual data is stored on other partitions, eg `~/git/project1` => `/git/project1`, `~/Pictures/Wallpapers` => `/data/Pictures/Wallpapers`, etc. The shell can be set up to spawn in some custom directory, $CDPATH can be altered for quicker navigation or completions, configurations are managed by Nix so I simply don't have a reason to look at my $HOME that often.

Programs can pollute it all they want, since I don't use it myself I also don't have to care about that.

Re: Tips on how to structure your home directory (2023)

#157
I manage dotfiles with Vorta backups. I don't want to deal with symlink management and such, and it's an easy way to say "These five manually selected dotfiles get saved". I have a separate Vorta profile just for them.

I have projects folders for each category of project, and each project gets a folder. Anything programming related, gets a git repo.

I used to have my top level folders by category, documents, code, etc, and that was a miserable idea. I much prefer sorting by project.

Any folder can have an "Archive" dir for old stuff.

I also have a Collected folder, for stuff that's I just found online and saved, sorted by category. Stuff like RasPi os images and sound fonts go there. It's like downloads but less ephemeral.

Then I have the one that people might not like... TheRuins. Whenever I do a clean reinstall of an OS, which used to be every few years, my old home dir would go there.

I don't want to just use a new home dir, because for one thing it's probably 95% stuff I don't actually need, and also it might have files for some old version of some app that might break the new one.

Stuff I actually DO want, I can manually move along into my new home dir out of the old Ruins.

The rest can just stay until I eventually need more space and move it into an SSD.

All of my media files live in a folder synced with SyncThing, as do a lot of other things.

Stuff I really want to keep gets replicated to my phone and tablet, as well as actually being backed up.

Finally everything gets backed up with Vorta. It's deduplication is amazing when you often move stuff around in a Ruins folder.

If I had the budget, I'd probably have a NAS with two disks, one as a backup target, and the other for general storage.

Re: Tips on how to structure your home directory (2023)

#158

Earlier quoted context omitted.

That's only two applications to configure though.

The `~` path (and `cd` with no arguments, to get there) are also part of the prime real estate. It's as if these polluters think you'll enjoy accessing their stuff via `~/ ` which might or might not be true.

Polluters probably assume you'll never access anything at all except through dedicated apps, and bookmarks. In my case it's mostly true but it's still icky and ugly to see a crowded home dir.

Re: Tips on how to structure your home directory (2023)

#159
post #2

I remember I deleted a built-in directory like "Documents", and it lost its custom document icon, even when I created a "Documents" directory anew. No amount of googling / asking forums and IRC could bring my custom icon back. :) (Linux Mint, Cinnamon)

https://man.archlinux.org/man/user-dirs.dirs.5.en If you delete one folder the file $HOME/.config/user-dirs.dirs will be updated sooner or later, and point to $HOME/ and the icon will not be restored by recreating any folder. Just change the values in there to whatever.

Whoa! I will try that, thank you!

Re: Tips on how to structure your home directory (2023)

#160
post #99

Earlier quoted context omitted.

I can’t tell if this is sarcasm or not. $HOME is the one directory which belongs to the user. In some cases, it might even be encrypted with a user-owned key. I can’t imagine being comfortable putting my files anywhere _outside_ of the home directory. That feels like going back to the DOS / Win3.x days where hard drives were the wild west.

I follow the above advice. My personal stuff is in $HOME/$MY_FIRSTNAME. I can organize this directory any way I want to, e.g. by project, time, purpose, whatever. It’s my stuff. The stuff in $HOME is then more “the computer’s stuff.” (E.g., on MacOS, Photos, Desktop, Downloads - that’s where the computer dumps that stuff.) The other place is where I put things. This turns out to work quite well. It allows me to be un…

I read the original comment as recommending against putting _anything_ in $HOME. Your solution is far more palatable.
Post reply on HN