NEXT UP previous
Next: The Password File

Exploring the File Hierarchy

When you login, there is a special directory associated with your login name called your home directory. Your home directory is actually your initial current working directory. It is the directory that acts as the starting point (the root if you like) for the part of the overall directory tree that belongs to you. All the files and directories that you create as a part of any work you do on the system will generally be located under your home directory.

The simplest way to find out where in the directory hierarchy your home directory is located is just to use the command pwd straight after you login. The pwd command tells you your present working directory. This is the directory you are currently 'in', which will be your home directory when you first login. Using the pwd command from your home directory will give output like this:

	$ pwd
	/home/you

where /home/you will be replaced by the absolute pathname to your home directory. In order to move your present working directory away from your home directory to somewhere else in the directory hierarchy, you use the cd (change directory) command. So, to change directory to the directory hierarchy's root directory you would use the command:

	$ cd /

thus giving the pathname of the required destination directory as a parameter.

In order to obtain a list of the names of the files and directories that are contained in the current directory you use the ls command. Using the ls command on the root directory of a typical Linux system gives an output such as:

	$ ls
	bin	dev 	home 	     mnt	sbin	var
	boot	dos	lib	     proc 	tmp	vmlinuz 
	cdrom	etc	lost+found   root	usr

The most important branches of the Linux directory hierarchy are shown in Figure 2. You should use the pwd, cd and ls commands to explore this directory hierarchy on your own machine.

If at any point you want to get back to your home directory you can obviously use the cd command and give the appropriate pathname as a command line parameter. But, if you just enter the cd command without specifying a destination directory this is a short cut that will also take you straight back to your home directory.

The main branches of the Linux directory hierarchy, as shown in Figure 1, contain files which have the general functions given in Table 1. below.

Table 1. The main directory list

/binBinary executable commands
/devDevice special files
/etcSystem admin. and config. files
/homeBase for user home directories
/libStandard programming libraries
/sbinSystem admin. commands
/tmpGeneral store for temporary files
/usr/X11X windows system files
/usr/admSystem admin. data files
/usr/binMore executable commands
/usr/libLibraries and package config. files
/usr/local/binLocally added commands
/usr/local/libLocally added libraries
/usr/local/srcLocal command source files
/usr/manSystem online manual pages
/usr/src/linuxLinux kernel source files
/varOverflow for some large files


NEXT UP previous
Next: The Password File