File Management – File and Directory Naming Conventions

conventionsdirectory-structurefilenames

I want to refactor the files and directories on my system. However I am not sure what is best practice.

After reading this question and its answers I assume the most important part is to be consistent. However, this is where I'm stuck. E.g. in root, there are directories such as /bin and /usr, which all use lower-case letters. But in my user's directory /home/foobar/, there are already a bunch of directories such as ~/Pictures, ~/Documents and ~/Music (which are capitalized)!

Maybe this is just because I use Ubuntu, but what is considered best practice?

Best Answer

There are a couple conflicting parts here. The comment about being able to do whatever you want is true, but it will also make much more work for you in the long run.

If you have any idea about re-arranging anything outside of your home directory, stop! That's way more complicated than you think and you should leave it alone. If you don't like it you should change to a different distro or even operating system. If none suit you you would need to roll your own, but you can't just move system directories around without getting burned. See this question for some idea what would happen if you wanted to go that way.

So we're down to your home directory.

First of all, remember as you think up a structure that permissions are hierarchical. In order for somebody to have permissions on a given folder, they need to have at least execute permissions on every folder ABOVE that folder. If you have anything in your home directory that you share, it needs to be near the top (e.g. ~/Music), anything you want to restrict should be in subfolders with limited permissions (e.g. ~/.ssh/id_rsa).

Secondly, there are no rules or even best practices per-se but there are conventions. Lots of software use default values that you may or may not be able to change, but even when you can change them it's troublesome to have to do constantly. Gnome, and particularly Ubuntu stuff, likes folders with nice names starting with capitals. If you try moving "Downloads" to "downloads" you'll find the original probably gets created again before too long by some program with an assumed default. You'll have to decide how much swimming against the tide you want to do in these cases.

Related Question