Live data from Hacker News

Tips on how to structure your home directory (2023)

unixdigest.com

81–90 of 172 posts

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

#82
It seems to me that directories are a fundamentally flawed system or organizing files. A natural way to start a directory structure is by basing it on the type of file (i e. games, music, pictures etc) but that will quickly fall apart after you want your files of different "types" relating to X to be under the same directory. So now you can either create some symlink mess, include the wrong "type" of file in your directory tree, or restructure. The problem with restructuring is that it's a lot of work and the end result is not really worth it. What tends to happen (at least for me) is overly deep directory structures (and/or too much branching) that are tedious to navigate, and in the end have the same problem. Another option is to just bite the bullet and create a X subdir for each of your main directories that have relevant files for X which is what I do. But that really sucks and I wish there was a better alternative that actually worked with existing programs which assume a directory based organization. There are some alternatives that work on top of existing filesystems e.g. tag based systems but I haven't tried them yet and I suspect they have their own headaches.

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

#83
Reading the comments here makes me feel guilty. I'm sitting on probably a few hundred files and folders called something like tmp, tmp1, foo, foo23, foobar, testxyz, etc... They all hold probably very irrelevant stuff and are safe to delete, and I have yet to resort to those files for rescue, but you never know! Every now and then I collect them and put them in an archive folder. I'm now at "archive10".

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

#84
post #50

I actually have quite a simple structure that serves me well (your mileage might vary) projects/ 2023/ 2024/ 0000-something/ 0312-other-project/ 0419-hn-comment/ each year I make a year folder. And each project has a month + day prefix. Sometimes I want long term projects to pop up on top, so I prefix them with 0000 (or only make the day 00). It is simple, works on any OS. Although on Linux I do have some helper scri…

Yeah, I've migrated to this + a 'process'-kind of folder structure. I'll have more duplicate data, but it saves my sanity

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

#85
Whenever I'm thinking about sorting and filesystems, I think of this post from Stephen Wolfram [0] and it's HN discussion [1]. The bit on filesystems is titled 'My Filesystem'. The basic premise is broad categories are better than narrow. It has constrained my urge to waste time hyper-categorizing things.

[0] https://writings.stephenwolfram.com/2019/02/seeking-the-prod... [1] https://news.ycombinator.com/item?id=26045380

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

#86
I'm glad people keep writing these "how I set up my computer" articles because it's how I learned almost everything I know - thanks to the kindness of internet strangers.

anyway here's my idiosyncratic setup, would probably be terrible for anyone else:

everything goes in Dropbox (paid 2TB account)

my Dropbox subfolders are organized by broad filetype, e.g.

    ~/Dropbox/{Code,Documents,Videos,Downloads}
on a new computer I install Dropbox and create symlinks, e.g.

    /home/rml/.emacs   -> /home/rml/Dropbox/Code/personal/config/dot-emacs
    /home/rml/.Xinitrc -> /home/rml/Dropbox/Code/personal/config/Xinitrc
    /home/rml/Code     -> /home/rml/Dropbox/Code
    ... etc
Because I pretty much live in Emacs and manage files using `dired` I have lots of Elisp code and custom keybindings that take me to my most-used files and directories. For other "tier 2" things I either know where they are due to long habit (most stuff doesn't move or it's obvious which folder e.g. a PDF will be in) or I use a combination of `M-x locate` and `M-x grep` which works pretty well.

Re: concerns about "where apps store stuff" I mostly don't care because everything I care about is in Dropbox. If it's something I use a lot, its config is symlinked in wherever the app expects it to be - otherwise everything is a few `dired` commands away.

(On macOS `M-x locate` can be configured to use the builtin `mdfind` which works very well for finding things IME. I think it's what drives Spotlight.)

At some point I may set up 'recoll' and all that but so far I haven't needed it so I haven't paid the complexity tax of trying to configure that across Windows/macOS/Linux vs. good old locate/grep

FWIW because I limit myself to a "standard" set of apps (Emacs, browser, VLC, PDF/image viewer) the above setup works pretty much the same across Windows/macOS/Linux, so most of the time I don't have to care that much which system I'm typing into

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

#87
post #44
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…

The worst offenders are CLI tools written by people on Macs that do not respect XDG, because it's not a thing over there. So every tool gets to pollute your dotfiles with its own stupid directory. .rustup, .mix, .npm, .yarn, etc. But polluting your home directory like ~/go, without even the decency to hide it, is extremely rude and offensive.

Weirdly, enough, golang is one of the only programming languages that actually has built-in support for a cross-OS config dir location: [os.UserConfigDir()][1].

I don't really ever program in golang, but whenever I write a Node.JS/Python tool that does need a user-global config file, I just write my own implementation of it:

  function userConfigDir() {
    switch (process.platform) {
      case 'darwin':
        return `${os.homedir()}/Library/Application Support`;
      case 'win32':
        if (process.env['APPDATA']) {
          return process.env['APPDATA'];
        } else {
          throw new Error('%APPDATA% is not set correctly');
        }
      case 'aix':
      case 'freebsd':
      case 'openbsd':
      case 'sunos':
      case 'linux':
        return process.env['XDG_CONFIG_HOME'] || `${os.homedir()}/.config`;
      default:
        throw new Error(`The platform ${process.platform} is currently unsupported.`);
    }
  }
[1]: https://pkg.go.dev/os#UserConfigDir

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

#88
> Hyphen vs underscore in filenames and directory names?

> Originally, when I stopped using Windows back in about 1998, I was used to using spaces between words in filenames and directories. As I progressed into the world of Linux and BSD, I changed all spaces to underscores, but since I have done (and still do) a lot of web development I eventually settled on hyphens. I not only think it looks better, but the fact is that search engines interpret hyphens in file and directory names as spaces between words. Underscores are usually not recognized, and as such, their presence can negatively affect search engine optimization. Even though files in my home directory are my private files and not something I put out on the web, I have just settled on using hyphens everywhere.

I couldn't agree more. It's so practice to use hyphens when navigating on terminal that i think it should be a standard. It's even better than pressing every time to select an underscored filename or for spaces. Duh

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

#89
The following directories always exist in my $HOME. Usually there are also a bunch of other work-in-progress files scattered around, waiting for me to either categorize them, delete them, or give up and move them to one of the catchall directories (archive, ongoing, tmp, or projects/scratch depending on what they are)

3dp -> 3d printing files

archive -> manuals, papers, website backups, etc

audio -> music and sound files

bin -> scripts and hand-installed binaries

build -> other peoples' projects that i'm building or hacking on

CameraUploads -> symlink to my NextCloud camera upload folder

Documents -> some random documents migrated from Dropbox days

Downloads -> Downloads, organized by year, with cur year in root

notes -> textfile notes

ongoing -> catch all to get rid of stuff that i am not quite done with yet

personal-records -> water & power bills, medical records, pay stubs, etc

pics -> photos (mostly screenshots) from this PC specifically

projects -> my own projects that i'm working on (mostly git repos)

tmp -> theoretically, safe to delete at any time .... theoretically

BACKUP.TODO -> a textfile showing what i still need to back up out of my digital empire

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

#90
post #49
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…

Pro tip: don't put your stuff in your $HOME directory. $HOME is for applications to pollute. Put your stuff literally anywhere else.

My ORACLE_HOME is in /home/oracle. It's just supposed to work like that (leaving all of the /u01/app references aside).
Post reply on HN