|
|
You can return to your home directory from anywhere in the directory structure by typing cd on its own.
Your home directory is stored in the HOME environment variable. You can display this value using the following command line:
$ echo $HOMERemember to include the dollar sign in the command line: without it, the echo(C) command will simply return the word ``HOME''. For an explanation of environment variables, see ``Understanding variables''. For more on the echo command, see ``Forcing a program to read standard input and output''.
A useful tool for filesystem navigation is the tilde character (~). The shell expands a tilde to the absolute pathname of your home directory. This notation can be included in a pathname, as follows:
$ pwd /tmp $ cd ~/i486/dev/backup/scripts $ pwd /usr/martins/i486/dev/backup/scriptsBecause the pathname is absolute, you do not need to know where it is in relation to your current working directory.
The tilde can also be used in conjunction with other users' login names, acting as a shorthand way of accessing their files without necessarily knowing exactly where their home directories are located. For example, the following command line allows you to check a colleague's directories for any file called hyacinth:
$ find ~john -follow -name hyacinth -print(See ``Finding files'' for how to use the find command.)