Lecture 17 - Introduction to UNIX


Home


Objectives

Contents


1. History

Unix started about 1970, when Ken Thompson and Dennis Ritchie (at AT&T, Bell Labs) wanted a computer to use as a general productivity tool (word processing etc) that many users could use at the same time. They had a Digital Equipment PDP7, but were dissatisfied with the operating system. They were working on an OS called Multics which would have multiuser capabilities, but it became large and unwieldy so Bell Labs dropped the project. So they wrote the first version of Unix (The original name of Unix was Unics which is a pun on Multics). In the process, they also designed the C programming language.

Unix was made available to research and education and spread widely. It has been substantially enhanced over the years. It is available for most current computers (including versions for the PC and Macintosh). In 2001 Apple Computers introduced the latest version of the Macintosh operating system, MacOS 10 also called Mac OS X because the wonderful graphical interface of the Mac is built on top of a full Unix OS (that controls memory management, disk access, interfacing with peripheral devices etc.)

2. The UNIX Network

Servers

There are two main servers, redgum for student use and ironbark for staff.

redgum & ironbark

Workstations

The UNIX workstations we will be using in this subject are located in lab B1.11 (Computer Lab 3, also known as itlab3) and are networked into redgum's disk drive where your files are stored. The CS & CE Department has a number of different types of UNIX workstations, running different flavours of UNIX.

Logging On & Passwords

Students automatically have accounts on the Macs (B1.08) and on redgum. To log onto a Mac use your student on-line username (in lowercase) and password.

Registering for an account on the Linux Workstations

Before you can use the workstations in the Linux lab (B1.11) you need to register for an account.

To register for an account in the Linux lab. apply online at http://hopper.bendigo.latrobe.edu.au/unix_account (You will need your student online username and password). You will receive an email and you need to click on the link in that email.

Note: if you change your student on-line password after you create your account for the Linux lab, the password in the Linux lab will remain the same as it was.

3. Some Features of Unix

Unix has a fairly simple design philosophy. Understanding that philosophy helps to iron out any problems that you may have.

It is Multi-User:
It has individual user accounts:
Unix is command driven:
Unix has a Hierarchical File System (see below)

4. The Unix File System

Unix has a Hierarchical File System:
There is a special root directory where it all starts:
We refer to files by their absolute pathnames:
Files can be referred to by relative pathnames:
Not all files are stored on the local machine:

Structure of LTUB's Unix files as you see them from a workstation:

Directory Description
/ Root directory
/dev device drivers for terminal, printers etc.
/etc local - commands (normally this holds the including the password file 'passwd' )
/proc local - list/data of currently running processes
/sbin local - Unix command files
/tmp local - directory for temporary files
/Users NFS redgum - directory for all students' stuff
/Users/fjsmith NFS redgum - student fjsmith's home directory

5. General Unix Commands

As noted above, Unix is basically a command driven operating system. This means that users get the actions they want by giving commands. Commands all follow the same basic form: the first word is the name of the command. This is followed by options and arguments. Options are usually the minus sign "-" followed by some letters which change the action of the command. Arguments are usually the names of files on which the command is to act. Some useful commands are set out below:

exit
closes the current session (logs out of the session) - you can also use Ctrl+D to logout.
 
ls  [-al]
 
lists the files in the current directory, similar to the old DOS 'DIR' command. eg:
ls -a    all option lists all files, including any whose name start with a dot (which are normally hidden).
ls -l    long option lists more information about each file.
ls -al   all and long options (same as: ls - a -l)
 
pwd
gives the full pathname for the working directory
 
cd  pathname
changes the working directory to the new directory specified by the pathname argument given. Note that "." (a dot on its own) refers to the current working directory, and ".." (two dots) refers to the parent directory - the directory which contains the location information for the current working directory.
 
less  filename
copies the contents of the file to the terminal screen, one page at a time. Note that if this produces odd results, or complaints about the computer not knowing what kind of terminal you are using, you may need to set your environment - see the tutorial.
 
cat filename1 filename2 filename3 ....
prints the contents of the files onto stdout (the screen), one file immediately after the other.
 
man  commandName
shows the online manual entry for the command.
 
man  -k  keyWord
lists the commands that may have to do with the keyWord given. eg:
man -k copy         lists all commands that have anything to do with copying
man -k copy file    lists all commands to do with copying and/or files (whew!)
 
ps  [-ef]
shows all current processes - including the ps process that generates the list.
'-e' option shows all processes, '-f' provides a full listing
so, 'ps -ef' lets you see what everyone is doing:-).
 
who
lists the users who are currently logged onto the system
 
whoami
identifies the current user (useful if you find an unattended machine)
 
file  pathname
tells you what kind of file the argument is
 
df
shows the NFS mountings including the amount of disk free on your system
 
du
shows how much disk usage you have consumed.

6. Simple File Maintenance Commands

Listing your files

Creating a file

Deleting files

Copying a file

Moving or Renaming files

Viewing the contents of a file

Changing Directories

Executing (or Running) a Program

Editing a text file

6. Web Browsers

Firefox and Konqueror are two of the web browsers that are available on the workstations in the Linux lab.

7. UNIX Command Summary

A UNIX Command Summary listing commands relevant to Programming Environment is available.


Key Points

Further Reading


Written by Tim Whitfort.