Department of Computing Science
Introduction to Computer Systems
Umeå universitet

 

The Unix file system

The home directory

The directory you start at when you login is called your home directory. This could be, for example /home/c04/c04abc (see intro chapter). If you write cd and press enter you will cd to your home directory. The path will not say /home/c04/c04abc, but only ~. You should save your reports and laborations in your home directory. The directories are backed up daily so it is much safer to keep the files here than on your computer at home (if you don't keep backups at home, that is).

The directory structure

In Unix there are no drive letter like C: in Windows. Every partition and disk resides under the same tree /. Besides the home directory, there are a couple of other directories that you should know about:
/tmp - here you can put temporary files. This dir is emptied without notice
/home - where all home directories are located

Most of the time you should keep things to your home directory. Please don't save things anywhere else.

Permissions

In Unix every file (and directory) has information about who created them and who can look at them (read) and change them (write), plus a special permission (execute). There are three categories of users for which these permissions can be set: the owner, users in the same group (class) as the owner and other users. For each category permissions for reading , writing and execution can be set.

Example:
ls -l foo will show the permissions for the file foo.
--rw-r--r-- 1 perl 193 Aug 22 14:45 foo
The owner (perl) has the right to read and write (rw-)
Group members and other user has the right to read (r--).

To change permissions for a file, use the command chmod permissions filename. Below are the different permissions:

PermissionRight Means Shown as
7 read, write and execute rwx
6 read and write rw-
5 read and execute r-x
4 read r-
3 write and execute -wx
2 write -w-
1 execute -x
0 no rights --

For more sophisticated permission needs, ACL's (Access Control Lists) can be used (man getfacl,man setfacl).

Exploring the file system

If you are logged into the graphical user interface (X) you can use the file manager that is started when you log in to browse the files. This is very similar to explorer in Windows. We will now take a crash course in browsing in the non-graphical user interface.

This interface is very similar to the DOS command line in Windows (if you have seen it). cd followed by the directory name changes directory.
Example. cd /home changes to /home
cd .. changes up in the directory structure (from /home to /)
Create a directory with mkdir directory
Remove a directory with rmdir directory (the directory must be empty)

Please take some time to get used to the file system. The ls command shows the content of the current directory.man ls will show options and flags that can be passed to ls (ls -al shows all files and the permissions for them).

Files starting with . (a dot) are hidden files, if you would like to see them, add the parameter a to ls. Configuration directories for different programs, kept in your home directory, often start with a dot. Therefore, do not remove them unless you really know what you are doing.


----------------------------------------------------
Department of Computing Science
Umeå University
The information on this page was modified 2014-09-12
Responsible for this page: Webmaster
 
Address: SE-901 87 Umeå, Sweden
Phone: 090-786 50 00
Fax: 090-786 61 26
E-mail: datavetenskap@cs.umu.se