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.
/bin | Binary executable commands |
/dev | Device special files |
/etc | System admin. and config. files |
/home | Base for user home directories |
/lib | Standard programming libraries |
/sbin | System admin. commands |
/tmp | General store for temporary files |
/usr/X11 | X windows system files |
/usr/adm | System admin. data files |
/usr/bin | More executable commands |
/usr/lib | Libraries and package config. files |
/usr/local/bin | Locally added commands |
/usr/local/lib | Locally added libraries |
/usr/local/src | Local command source files |
/usr/man | System online manual pages |
/usr/src/linux | Linux kernel source files |
/var | Overflow for some large files |