Unix File Structure

UNIX has a tree-like file system starting at the highest level with a directory called root (referred to as /). A directory on Unix is similar to a folder on a microcomputer. The structure and content of many of the directories is similar on various UNIX implementations. That is, the user does not decide how to set up all of the directories. There is a preset meaning to certain directories. Directories like bin, usr and etc contain certain system level information and are maintained by a system administrator. The figure below displays the uppermost levels of some of the directories. The directory you will be most interested in is your home directory and that will be found somewhere under the /home directory path.

Viewing contents of your directory

Use the "ls" command for a simple listing of your files, as shown in the example below:

$ ls
assem.cpp cs2xxx classes create

Use the "ls -l" command to view more extensive information about the files.

$ ls -l
-rw-r----- 1 juser user 14769 Feb 3 19:38 assem.cpp
-rw-r----- 1 juser user 5708 Jan 14 20:37 cd.txt
drwxr-x--- 4 juser user 8192 Mar 29 19:20 classes
-rw-r----- 1 juser user 2688 Feb 3 19:38 create
lrwxr-xr-x 1 juser user 30 Mar 29 19:20 cs2xxx ->/home/classes/cs2xxx/juser
A B C D E F

  • A File types and permissions (see next figure)
  • B Indicates the owner of the file
  • C Indicates the group that can access the file.
  • D Gives the size of the file in bytes
  • E Gives the date and time that the file was last modified
  • F File name. For symbolic links (like cs2xxx above) shows the file being pointed to

Relationship between a personal directory and the class directory

You will be issued one permanent personal bglinux account that you will use for both class and personal use for as long as you are at BGSU. For each CS class you take you will need to issue a special command to "join" the class. Class accounts are created in another directory but, for ease of navigation, a symbolic link is placed in your home directory to allow you to easily access the class directory that has been assigned to you. At the end of the semester the symbolic link will be replaced with a directory containing all of your work for that class. This allows you to save your work in your own home directory once the semester is finished.

How to refer to directories

The following example shows ways for juser to go to the class directory.

  Absolute path Relative path
Description path always begins with root (/) starts looking in current directory
Examples
cd /home/99/juser/cs2xxx
cd /home/classes/cs2xxx/juser
cd cs2xxx
Result Either command can be used from anywhere since each gives complete information about the location of the directory This command can be used only within juser's home directory (/home/99/juser)

Other directory commands

The following commands, given in the Unix Overview  relate to directories: cd (change to a new default directory), mkdir (create a new directory), pwd (display the current default directory), rmdir (remove a directory).

Updated: 08/01/2018 06:38PM