LINFO

Home Directory Definition



A home directory, also called a login directory, is the directory on Unix-like operating systems that serves as the repository for a user's personal files, directories and programs. It is also the directory that a user is first in after logging into the system.

A home directory is created automatically for every ordinary user in the directory called /home. A standard subdirectory of the root directory, /home has the sole purpose of containing users' home directories. The root directory, which is designated by a forward slash ( / ), is the directory that contains all other directories and their subdirectories as well as all files on the system.

The name of a user's home directory is by default identical to that of the user. Thus, for example, a user with a user name of mary would typically have a home directory named mary. It would have an absolute pathname of /home/mary. An absolute pathname is the location of a directory or file relative to the root directory, and it always starts with the root directory (i.e., with a forward slash).

The only user that will by default have its home directory in a different location is the root (i.e., administrative) user, whose home directory is /root. /root is another standard subdirectory of the root directory, and it should not be confused with the root directory (although it sometimes is by new users). For security purposes, even system administrators should have ordinary accounts with home directories in /home into which they routinely log in, and they should use the root account only when absolutely necessary.

There are several easy ways for a user to return to its home directory regardless of its current directory (i.e., the directory in which it is currently working in). The simplest of these is to use the cd (i.e., change directory) command without any options or arguments (i.e., input files), i.e., by merely typing the following and then pressing the ENTER key:

cd

The tilde (the wavy horizontal line character) is used to represent users' home directories on Unix-like operating systems, including users' home directories that are used to store web pages on Unix-like web servers. Thus, a user could also return to its home directory by using the tilde as an argument to cd, i.e.,

cd ~

The absolute pathname of a user's home directory is stored in that user's $HOME environmental variable. Environmental variables are a class of variables that tell the shell (i.e., the program that provides the text-only user interface for entering commands) how to behave as a user works at the command line (i.e., all-text mode). Thus a third way for a user to return to its home directory is to use $HOME as an argument to cd, i.e.,

cd $HOME






Created June 17, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.