October 3rd, 2018

Today’s class will be very practical

What is UNIX?

UNIX is an operating system

  • invented in 1969 at Bell Labs (AT&T)
  • developed in the 1970s
  • under constant development ever since
  • multi-user
  • multi-tasking
  • system for servers, desktops and laptops.

Computer were big and expensive

Several people used the same computer

at the same time

Each person used a dumb terminal

Each computer had its own system

AT&T engineers designed UNIX

to work in all servers

UC Berkeley adapted UNIX for research

All UNIX systems have a text interface

UNIX systems also have a graphical user interface (GUI)

  • similar to Microsoft Windows
  • easy to use environment

However, command line interface is also used

  • for operations which aren’t covered by a graphical program
  • when there is no windows interface available
    • for example, using a cloud server

So this…

… became this

Types of UNIX

There are many different versions of UNIX they share common similarities

The most popular varieties of UNIX are Linux, and MacOS X

In old times we also had Solaris, Minix, Ultrix, AIX, DG/UX, Irix and Unix

Operating system

Set of programs which make the computer work.

The UNIX operating system is made up of three parts:

  • the kernel
  • the shell
  • the programs

Parts of UNIX

The kernel

The kernel of UNIX is the hub of the operating system:

  • it manages time and memory for programs
  • handles the disk and secondary storage
  • handles communications and networking

The kernel wraps the different hardware. No other software can interact with the hardware.

Programs have to ask to the kernel to access the hardware

The shell

Interface between the user and the kernel

When a user logs in

  • the system checks the username and password
  • then starts another program called the shell
    • a command line interpreter (CLI).
  • it shows a prompt $
  • It interprets the commands the user types and executes them
  • The commands are programs
  • When they finish, the shell gives the user another prompt $

Filename Completion

Tricks of the shell

By typing part of the name of a command, filename or directory and pressing the [Tab] key, the 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, asking you to type a few more letters before pressing the tab key again.

History

More tricks of the shell

The shell keeps a list of the commands you have typed in

If you need to repeat a command,

  • use the cursor keys to move up and down in history
  • or type history for a list of previous commands

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 called root
    • written as /

The Directory Structure

In the diagram above, we see that the home directory of the user ee51vn contains two sub-directories (docs and pics) and a file called report.doc

The full path to the file report.doc is /home/its/ug1/ee51vn/report.doc

Listing files and directories

ls (list)

When you first login, your current working directory is your home directory

To find out what is in your home directory, type

$ ls

The ls command ( lowercase L and lowercase S ) lists the contents of your current working directory.

ls command

There may be no files visible

In that case, the UNIX prompt will be returned

ls does not show all the files but only those ones whose name does not begin with a dot .

Files beginning with a dot . are known as hidden files and usually contain important program configuration information.

They are hidden because you should not change them unless you are very familiar with UNIX!!!

Listing hidden files

To list all files in your home directory including those whose names begin with a dot, type

$ ls -a

Commands can have options

ls is an example of a command which can take options: -a is an example of an option.

The options change the behaviour of the command.

There are online manual pages that tell you which options a particular command can take, and how each option modifies the behaviour of the command

How to know the options?

In the old times, people looked it in the “Manual”

Later people realized that you can have the manual in digital form, inside the computer

To see the manual page of ls, use the command man ls

Original material