UNIX: The Operating System

Operating systems (like DOS, VMS, and UNIX) are control programs, which manage the hardware and software of a computer system.

So it is the operating system that allows you to type in and execute your commands and to see at screen what happens.

UNIX, first developed in 1969 at AT&T Bell Laboratories by Thompson and Ritchie as a file system structure to manage a word-processing program (the name UNIX is a joke: AT&T's just developed multiuser system Multics had failed), is not only the operating system but the related utility programs, too; it allows you to execute many programs and commands at the same time - this is called multitasking and it enables the computer system also to be used by more than one user at the same time - therefore UNIX systems are called multiuser systems.

UNIX systems have one very serious problem: There is no guaranteed response time - so you can't use them in (some) real time applications.

First it was written in assembler code, then there were two new languages to overcome the problem of machine dependence: B by Thompson and then C by Ritchie.

UNIX Interface: Shell

UNIX's user interface is called shell (because it encloses the UNIX kernel like a shell) - the standard shell is the Bourne shell (developed at AT&T). A shell is simply a UNIX program, that reads and interprets your commands, and it is a high level programming language, too;

The C shell is a special shell (developed at U.C. Berkeley) to improve the comfort in using UNIX systems. The name comes from the C language, because the programming language of the C shell is based on the C language syntax.

The C shell allows you to customize your system environment and to simplify your work with command shorthands, aliases and history mechanisms.

Some of the enhanced job control features of the C shell run only on systems from the Berkeley Software Distribution (BSD) and some UNIX commands may have different options on different UNIX systems, so use the online manual (man pages).

UNIX File System

The UNIX file system is hierarchical, this means it branches out from one single point: the root (/) but it might spread out over several devices, which you can see, when you type mount.

  $ mount
  /dev/cciss/c0d0p1 on / type ext3 (rw)
  none on /proc type proc (rw)
  none on /sys type sysfs (rw)
  none on /dev/pts type devpts (rw,gid=5,mode=620)
  usbfs on /proc/bus/usb type usbfs (rw)
  none on /dev/shm type tmpfs (rw)
  /dev/cciss/c0d0p4 on /tmp type ext3 (rw,usrquota)
  /dev/cciss/c0d0p2 on /var/log type ext3 (rw)
  /dev/cciss/c0d1p1 on /home type xfs (rw,usrquota)
  

Every directory may contain subdirectories, plain files, and links to files in other directories. Every UNIX user has its own starting point, this is called his home directory (~) and the subsystem below this node belongs to this user. The home directory is the current working directory (cwd, .) when you login.
You can switch the user by the command su [-] [username]: If you give the minus-symbol before the username, the shell will read the special files of user username, too.
If you don't give an username, you will switch to the super-user root - the most privileged and important user on UNIX systems.

Files (directories are files too) can be accessed by their absolut or their relative pathnames. (Pathnames are the roadmaps through the file system and they are unique filenames)

Absolute pathnames always start with root (/), followed by the sequence of directories (separated by slashes) that leads to the file. The absolute pathname of the cwd is returned when you type the command pwd - print working directory.

Relative pathnames start with ., .., ~ or ~user.
.. is the relative pathname of the parent directory and ~user is the home directory of user user. Add . to your path variable (unless your system administrator has not done it) and you do not have to give the full relative path (./ is not necessary at the beginning of the pathname).

You can move around within the file system by using the command cd (changing the directory). cd without an argument will take you to your home directory (~).

The filenames and command names in UNIX are case sensitive - UNIX distinguishes between lower and upper cases - so be sure that you have typed the filenames correctly! (Files named PETER, Peter, and peter are 3 distinct files!).
Files beginning with . are invisible, because ls does not display them without -a.

Files have a file mode: it defines the access permission to the file for the user, the group, and others.

A link is a pointer to a file: Links are different names for the same file (e.g. as abbreviation or because an application needs a certain filename) that allow you to share files. In BSD-version there are hard links and symbolic (soft) links; symbolic links can refer to directories too and they can be made across file systems.

. and .. are hard links (to the directory itself and to the parent directory respectively).

$ pwd
/disk1/users/peter
$ cd bin
$ pwd
/disk1/users/peter/bin
$ cd
$ pwd
/disk1/users/peter
$ cd ..
$ pwd
/disk1/users
$ cd /disk1/users/peter/bin
$ pwd
/disk1/users/peter/bin
$ cd ../F90
$ ./program
(or simply program if you have added . to your path variable)