Setting up a home directory


Author: Michael Stutz

Your home directory is the place where you keep your own files. Good organizational skills and some foresight will help keep your “home” in order. Here are some hints for organizing your home directory.

This article is excerpted from the recently published book The Linux Cookbook, 2nd Edition.

You’ll find that the home directory as outlined here mirrors, in many ways, the /usr/local directory tree, which itself somewhat mirrors the system root directory, /; this is no coincidence. The Linux directory tree structure is well-organized and lends itself to this purpose; I’ve found that the home directory, and directories for any particular project or “thing,” usually have some similar directories and files: bin, doc, etc, src, tmp, THANKS, passwd, and so on.

You can configure your home directory any way you like, and you can change it at any time, of course. There is no rule that says, “You must store this kind of file in a directory here,” “You must have an etc,” or anything like that. Here is what I do.

Using a directory for personal binaries

A directory for binaries is simply a directory where you store executable files. To make the shell recognize it, add this directory to your path variable, as defined in your ~/.bashrc file. The directory can have any name. I prefer sticking with the bin convention and putting it right in the home directory: ~/bin.

To make your own bin directory and add it to your path, do the following:

1. Use mkdir to make a bin directory in your home directory:

$ mkdir ~/bin

2. Use a text editor to edit your .bashrc, and change the path to include ~/bin. It is a quoted, comma-delimited list. For example:


In your own bin, you can put scripts and tools of your own devising. They will be executable by you, but by no other users on the system. To make a file executable by all users, the superuser will have to put the file in /usr/local/bin, the system-wide local directory for binaries.

NOTES: The current shell won’t recognize any changes you make in your .bashrc; you’ll have to run it by hand the first time, or just exit and start a new shell.

Using a directory for personal lists and data

Everybody has his own set of personal files containing lists, data, and other “configurations,” such as passwords, accounts and pass-phrases, account information, addresses, and so on. These are good things to put in a directory named etc. Some people might like using personal or per for this instead, but regardless of the name, I find that having a directory for expressly this purpose is very handy.

This is a good place to keep the kinds of files listed in the following table.

address or addr or contacts Address book
appointments or todo or TODO To-do list. Uppercase file names are sorted first in directory listings.
birthdays List of birthdays.

personal calendar file. You can keep specialized calendars for your
interests, such as calendar.birthdays or calendar.wwii.

crontab Personal cron table file.
passwd or passwords Personal password file. Be sure to change its permissions so that nobody
else can look at it.
quotes Favorite quotations.

Using a directory for mail

You will probably want a directory to keep all your email correspondence, including both incoming and outgoing mail. Most people use either Mail or mail as the name of this directory; many email applications use one name or the other as the default for storing messages. You can build subdirectories in here to store messages away in neater folders, such as outgoing for outgoing mail, family for family correspondence, and projects for project mail.

Using a directory for projects

It is sometimes desirable to keep a group of files together when working on a project of some sort. Depending on your work and enterprise, you might like to make a directory for your projects — say, jobs, projects, work, drafts, or research, depending on what you do, and make subdirectories in it for any particular project or job you are working on.

Programmers usually have a src directory for computer program source code; other common directories for special work that you may want to consider include photos or photographs, art or images, books, and music or recordings. Hobbyists might keep scrapbook or craft directories.

These main categories may, in turn, contain directories for particular projects, and those project directories may contain their own src directory for source files, doc for documentation, a THANKS file for acknowledgements, and so on.

Using a directory for temporary files

You might like to have a directory that you use as a kind of “holding pen” to bring in new files that perhaps should be processed soon, but not right at the moment. I don’t like to clutter up my home directory, so having a ~/tmp directory to put these things in keeps it clean and tidy.

You can, of course, save files in the system-wide temporary directory, /tmp, but that directory is cleared out periodically by the system, and if you are on a multi-user system, you might want to have a private temp directory anyway (all users normally have read and write access to /tmp).