2.1 UNIX Hierarchical File System


Unix Files: 		File type Symbol (See ls -l output, 1st column)
 (1) Ordinary Files			-
 (2) Directories			d
 (3) Character Special Files		c
 (4) Block Special Files		b
 (5) Symbolic Link Files		l
 (6) Named pipes			p
 (7) Sockets 				s

Examples:

$ ls -lad .bash_profile /home/cis/rkatz /dev/ttyp9 /dev/fd0h1440 /dev/adsp \
/dev/log /dev/initctl    # (sorted)
-rw-r--r--    1 rkatz    rkatz         286 Jun 23 10:57 .bash_profile
brw-rw----    1 root     floppy     2,  40 Sep 27  2000 /dev/fd0h1440
crw-rw-rw-    1 root     tty        3,   9 Sep 27  2000 /dev/ttyp9
drwxr-xr-x   15 rkatz    rkatz        1581 Jun 30 06:23 /home/cis/rkatz
lrwxrwxrwx    1 root     root            5 Dec 21  2000 /dev/adsp -> adsp0
prw-------    1 root     root            0 May 15 04:05 /dev/initctl
srw-rw-rw-    1 root     root            0 Mar 29 03:36 /dev/log


Unix Directory Structure looks like an upside down Tree.  Root = /
subdirectories of root are branches, files are leaves on branches.
Subdirectory or file separator is / also.

When you log in you are always starting in your home directory.  Each 
command is always associated with a single directory that is your current 
directory.

Use the pwd command to determine your current (present) working directory

Directory naming conventions:
Absolute path name of a directory starts at the top of the file system: /

pwd gives the absolute (or full) path to your current directory:

pwd (1)			- display the pathname of the current working directory

cd (1)			- change working directory

Relative path name of a directory starts with the current directory and
continues with the directory name or continuing path.

The . is the symbolic name given to the current directory without naming it
The .. is the symbolic name given to the parent of the current directory.
To obtain a grandparent from this, use ../..

In the Bash, Korn and C Shells, the symbol ~ indicates your login directory.  
Further, ~ represents that userid's home directory
The Shell variable $HOME represents each user's (your) login directory.

$ # Try typing these once logged in.

$ pwd		# Show current working directory

$ cd /bin	# absolute path

$ cd bin	# relative path

$ cd $HOME	# your login directory

$ cd ~		# Also

$ cd 		# Also

$ cd ..		# Change to the parent of the current directory

$ cd ../..	# change to the grandparent (/) of the current directory

$ cd ./subdir	# change to a subdirectory of the current directory
$ cd subdir	# Same 

$ cd -		# change to the previous directory (prior to the last cd)

$ ls -ld subdir	# just display the attributes of the directory subdir, not
			its file members.

Questions? Robert Katz: rkatz@ned.highline.edu
Last Update June 17, 2003