Introduction to Unix

The information on this page will help you get started with Unix. This page will discuss the following things, among others:

  • Basic information about the Unix- and Linux-based operating systems
  • Logging on to a Unix system
  • The file system in Unix
  • The most common commands for managing a Unix connection and Unix account

The Unix and Linux operating systems

Unix used to be the operating system for large organisations and mainframe computers, but these days Unix and similar operating systems are widely used by private individuals, as well. The Linux operating system, for example, which was created as an answer to the commercial Unix, has become very popular both in the corporate world and in private use because it is free. The following image shows an example of what Linux may look like on a home computer:

ubuntudd_iso[1]
Larger image

As you can see, Linux is very well suited for use at home. There are a wealth of different programs available for Linux, and most of them are free. The software includes:

  • The OpenOffice program package: the package includes the Writer word-processing program, the Calc spreadsheet program, the Impress slide-show program and the Base database program.
  • Different Internet programs: including the Firefox browser, the Thunderbird e-mail program and the Skype instant messaging program.
  • Different image-processing software: such as GIMP, a very versatile image-processing program that is completely free.

Several different versions of Unix and Linux have been developed over time. The following lists a few of the most popular ones:

  • Unix: Aix, HP-UX, Solaris
  • Linux: the distribution versions Debian, Fedora and Ubuntu

If you are interested in using Linux on your home computer, take a look at the different distribution versions of Linux! Most distribution versions of Linux can be downloaded from the web for free. Popular versions include Ubuntu, Fedora and Debian.

Initiating use of Unix

You will reach the most authentic Unix or Linux experience by using a workstation with the Unix or Linux operating system. However, Unix is often used by making a terminal connection to a server running the Unix operating system. You will find such a Unix system at the University of Helsinki (if you get an account to this Unix system, you will not need to install the operating system at all but will have access to all the Unix services offered by the university).

How you use Unix depends on whether you are using a Unix workstation or the server system. If you are using a workstation, the graphical user interface in Unix will be useful, but logging on to the Unix server from a remote terminal is usually done via a text-based user interface.

You can log on to the server in different ways:

  1. A remote connection with an SSH program
  2. A remote connection with a Java applet
  3. A graphical remote connection with the so-called X Window System

If you get an account to the UH Unix system (read more), you can access many programs on the Unix server at UH. v

Many features to do with e.g. programming are much better supported in Unix and Linux than in many other operating systems. Furthermore, there are many scientific programs that can only be run in Unix.

An SSH remote connection

A secure SHH connection is usually used to connect to a Unix server (with e.g. the freeware Putty). When making an SSH connection while on a UH campus, you will usually only have to type in just the server name as the server address (e.g. sirppi), without an exact address (sirppi.helsinki.fi). When accessing the server from outside the university, you will need to type in the whole server address.

If you are not familiar with SHH connections, please read the instructions at Contacting a unix server with the Putty software.

A graphical remote connection and the X Window System

Remote connections made with an SSH program or Java applet etc are usually text-based, but there are several Unix and Linux programs (syuch as some statistic and mathematics programs) that should be used with a graphicalconnection along with the X window system.

To use the X window system, install the WinaXe software (you can download it from the university software distribution). Read more about how to use the X window system on the page on the X window system with the Putty program.

The file system in Unix

Unix has its own file system that differs somewhat from those in other operating systems. The main differences pertain to naming practices for files and directories, directory trees, user access to files and directories, and home directories for Unix users.

Naming files and directories in Unix

When you use Unix it is important to observe the following special features of files and directories:

  • With Unix, capitals and SmaLL leTTeRs MaKe a differenCE: Unix will regard e.g. the files called thesis.rtf and Thesis.rtf as two separate files.
  • File names do not need to contain file extensions in Unix: the extension (e.g. .txt) does not have to be added to the file name, though it is not forbidden, either. However, extensions mostly only serve users themselves.
  • Unix allows the use of most special characters in file names: you can use special characters in Unix file names as long as you keep in mind that / is reserved for other purposes. Read more about how special characters can be used in different operating systems in e.g. Wikipedia.
  • A file name can be up to 255 characters long in Unix: though it is possible to use very long file names, it usually makes more sense to keep them short.

Directory trees in Unix

The structure of the directory tree in Unix is ‘treelike,’ as its name indicates. In practice this means that:

  • All the directories in Unix share one root directory 
    • You can access all other directories from the root directory
    • The root directory is marked with a slash /
    • Sub-directories are accessible from the root directory, and  different directories are also separated by a slash / – the directory /home/, for example, is a root directory for Unix users.
  • Unix does not use disk unit identifiers (such as C: or E:).

Though Unix is often handled via a command line, you can easily manage the Unix directory tree via a graphical interface. The image below shows the tree view in one of the Linux distribution versions; the root described above is the same as ‘File System’ in the image.

With Unix, storage media like USB memories etc are usually available from a directory called /mnt/ or /media/ instead of a disk unit. To use these media they have to be mounted, i.e.incorporated into the Unix system; with Unix different storage media are initiated by specifying that they are to be accessed through a sub-directory of /mnt/ or another similar directory.

When using Unix you will sometimes have to access a working directory instead of a certain sub-directory in the directory tree. A dot (.) is used to refer to a working directory in Unix. To refer to a directory one step above the working directory in the tree is referred to with two dots (..).

Access rights to files and directories

With Unix, as with many other multi-user operating systems, it is very important to know how to specify access rights to files and directories (read more about rights). With Unix, you can specify access rights for the user, a group and for other users.

There are several ways to specify access rights to your files and directories. The rights most often specified are read (r), write (w), and execute (e). To read the contents of a file, you need read access to the file, while you need write access to modify it. If you want to write a program that starts via the command line, you have to set execute access for the program file.

The access rights specified for the different groups of users are shown in the following order in file and directory listing:

  • Users: user (u), group (g), other (o) – i.e. ‘ugo’
  • Access for each group: read (r), write (w) and execute (x) – i.e. ‘rwx’

The following example shows how the access rights are shown in a directory listing. You can see that only the user rkeskiva has read and write access to both rtf files in the directory.


How to change the access rights is described in the following section.

Home directories

Each Unix user has their own home directory. The home directory is in the /home folder and its name is usually the same as the user’s Unix username. The home directory of user rkeskiva, for example, is:

/home/rkeskiva

Please observe the following special features on using the home directory:

  • You can either refer to the home directory as described above (by referring to the home directory as /home/rkeskiva) or with the help of the tilde (~). Using the ~ is often the quickest way to refer to the home directory.
  • You can access the files in your home directory by contacting a Unix server with a Unix workstation, SSH client program or SFTP program. If you use the SFTP program, you can transfer files between the Unix server and e.g. your home computer (the SFTP program will be described in more detail in the next chapter).

Commands for managing the Unix connection and account

Since Unix is usually managed via a command line, you had better learn the most common command prompts for managing Unix. Most of the prompts presented here will work in other similar operating systems (such as Linux), as well. Keep in mind that most Unix prompts are written with lower-case letters.

Many prompts take some additional attribute or parameter, as well as data on which object is the target of the prompt. Parameters and object are written after the prompt itself:

 prompt parameter(s) object

passwd

This prompt is used to change the password to the Unix user’s own profile information, i.e. the user account.

Change the password with the prompt passwd (this entails giving your old password):
 % passwd

Current password:

quota

This prompt shows how much disk space there is in your home directory.

Usually the parameter ‘-v’ is used with the quota prompt. The green text in the example below shows the output of this prompt:
 % quota -v

Disk quotas for user rkeskiva (uid 59642) at nili:
Filesystem usage quota limit timeleft files quota limit
/h/7 40496 200000 333333 329 100000 200000

finger

If used by itself, this prompt lists the users that are currently logged on to the server. If you give another user’s username as parameter to it, it will show the login information of that user.

See the information on user atorsion:
 % finger atorsion

Login name: atorsion In real life: Alisa S Torsion
Directory: /h/7/atkos/atorsion Shell: /bin/tcsh
On since Aug 16 09:25:10 on pts/47 from humlab23.it.helsinki.fi
No unread mail
No Plan.

logout, exit

These prompts will log you off the remote connection to Unix.

Log off Unix connection:
 % logout

Where do I find more information about the prompts?

man

This prompt opens the manual for the prompts. Most pages in the manual follows this principle: write the prompt you are interested in after the prompt man.

To learn about the prompt ls with the help of man, write the following:
 % man ls