UNIX/LINUX Introduction

This session concerns UNIX, which is a common operating system. By operating system, we mean the suite of programs which make the computer work. UNIX is used by the workstations and multi-user servers within the school. LINUX is simply a type of UNIX that has been adapted to run on a wider range of hardware. We will be using computers that run LINUX in this class, but this tutorial applies to all variations of UNIX.

On X terminals and the workstations, X Windows provide a graphical interface between the user and UNIX. However, knowledge of UNIX is required for operations which aren't covered by a graphical program, or for when there is no X windows system, for example, in a telnet session.

The UNIX operating system

The UNIX operating system is made up of three parts; the kernel, the shell and the programs.

The kernel

The kernel of UNIX is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls.

As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the UNIX prompt % to the user, indicating that it is waiting for further commands.

The shell

The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt (% on our systems).

The adept user can customise his/her own shell, and users can use different shells on the same machine. We will be using the tcsh shell by default.

The tcsh shell has certain features to help the user inputting commands.

Filename Completion - By typing part of the name of a command, filename or directory and pressing the [Tab] key, the tcsh shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.

History - The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.

Files and processes

Everything in UNIX is either a file or a process.

A process is an executing program identified by a unique PID (process identifier).

A file is a collection of data. They are created by users using text editors, running compilers etc.

Examples of files:

The Directory Structure

All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root.

The Unix file structure

In the diagram above, we see that the directory student contains the subdirectory groupwork which has its own subdirectory act1. Note that each directory can also have files in them. The diagram also shows that the full path to the act1 directory is /home/student/groupwork/act1

The UNIX file structure is similar to that on Windows. Directories are like folders we see on Windows. The root directory (/) on UNIX is like the C:/ folder on Windows. Likewise, your home directory (i.e., /home/student) is like your My Documents folder.

Starting an Unix session

To start an Unix session on the Windows PCs in the Shideler 17 computer lab, you will need to use two programs: Xming and PuTTY. You can also start a Unix session from your own personal computer if you download/install PuTTY, Xming, and Xming fonts.

Xming

Xming is a program that allows Unix X windows to appear on our Windows desktop. You simply have to start this program for it to work, and it can be found in the All Programs Menu in our computer lab, by clicking on the Windows Start Menu.

PuTTY

After starting Xming, you can now establish a connection with a Unix computer. PuTTY is the program we will use to do the login process. PuTTY can also be found in the All Programs Menu, by clicking on the Windows Start Menu.

Once PuTTY is running, it will bring up a Configuration window. On the right side of this window, you will need to specify the name of the host computer your are contacting (veracruz.glg.muohio.edu).

PuTTY configuration window

Then you will need to click on X11 in the left side of the window to bring up the X window options. In the right side of the window, you can now select Enable X11 forwarding to make sure the host computer knows to send Unix X windows to your Windows desktop.

PuTTY configuration window

Now you can select Open at the bottom of the window.

 

An Xterminal window will appear and if you receive a PuTTY Security Alert click Yes to trust this host. Then after you enter your Miami username and our class password, you will see a Unix prompt, waiting for you to start entering commands.

An X terminal window at the Unix prompt

IMPORTANT: When you are done working in UNIX, you should type exit to log out of the system. It is a security risk if you leave yourself logged in while not actually working on the computer. Since all the other students in the class have their work on the UNIX system too, not to mention my research work, I would really appreciate it if you are responsible about logging out.

 

M.Stonebank@surrey.ac.uk, © 9th October 2000; Revised brudzimr@muohio.edu, 19th August 2006