You are on page 1of 35

Unix Operating system Overview

by Olufemi Olaewe
An operating system (OS) is essential software that facilitates seamless
interaction between users, applications, and a computer's hardware
components. It provides a reliable and efficient interface for accessing
critical system resources such as the CPU, memory, disks, and printers.

Prominent examples of widely adopted operating systems include


Macintosh OS, Microsoft Windows, Palm OS, and UNIX. Although these
operating systems differ in design and may offer alternative user
interfaces (GUI and/or Shell), they all deliver a comprehensive set of core
functionalities.
Operating systems offer two main interfaces: GUI and command line. The
GUI simplifies tasks and enhances user experience, while the command
line provides direct and precise control.

Generally, the user must know more details about the system in order to
use this interface, which is usually used to bypass the GUI to accomplish a
very specific task.
The diagram below is the pictorial view of the setup of a typical operating system. Here Master
Program is the kernel of the OS
Operating systems can be classified
according to the following
attributes:
Multi-User: Allows two or more users to run programs at the same
time. Someoperating systems permit hundreds or even thousands of
concurrent users.
Multiprocessing: Supports running a program on more than one CPU.

Multitasking: Allows more than one program to run concurrently.

Multi-threading: Allows different parts of a single program to run


concurrently.

Real Time: Responds to input instantly. General-purpose operating


systems, such as DOS and UNIX, are not real time.
The UNIX operating system

The UNIX operating system was developed in 1969 at AT&T Bell Labs by a
group of employees including Ken Thompson, Dennis Ritchie, Douglas
McIlroy, and Joe Ossanna.

UNIX is still one of the most widely used and popular operating system
and is used in a variety of disciplines including; businesses, universities,
institutions, and even individual homes to support a variety of
applications and functions. It is supported on a wide range of computer
systems—from a single personal computer to very large, high-end
workstations and servers and even mainframe class systems.

Also, it is many things to many people; for the software writer, UNIX is a
development platform to build software; for general users, it is using
whatever applications they need to accomplish their job; for the
administrator, it is a system that changes and must be maintained and
improved over time.
The UNIX system have evolved over the years and currently several
variants of it exists either as commercial or open source/access systems.
UNIX is constantly being improved, refined, and retooled. In other words,
it is constantly going through changes and enhancements. That is the
beauty of UNIX; like a fine wine, it gets better with age! The diagram below
illustrates the evolution of UNIX based systems.

The most popular UNIX leaders today include Solaris, Linux, HP-UX, AIX,
and SCO.
Characteristics of UNIX
Availability of Source Code: This is one of the key advantages of UNIX. It allows easy modification,
fixing of bugs if found in the source code. Also, new software functions can be integrated into the
source code, thereby increasing the usefulness and the overall functionality of the software.
However, the disadvantages of source code availability are: Tracking and managing multiple
versions of code changes can be difficult. Source code availability makes it easier for unscrupulous
users to exploit programming errors, particularly relating to security.
Flexible Design: UNIX was design to be modular. The modularity gives it a flexible architecture and
thus, helps provide a framework that makes it much easier to introduce new operating system
tools, applications, and utilities, or to help in the migration of the operating system to new
computer platforms or other devices.
GNU: the project was intended to act as a counterbalance to the widespread activity of corporate
greed and adoption of license agreements for computer software. Through this project the Emacs
editor and gcc compilers were developed among others.
Open Software: UNIX is open, which basically means that no single company, institution, or
individual owns UNIX nor can it be controlled by a central authority.

Programming Environment: UNIX provides one of the best development environments available
by providing many of the important tools software developers need.

Availability of Many Tools: UNIX comes with a large number of useful applications,utilities, and
programs, which many people consider to be one of UNIX’s greatest strengths. There are tools to
handle many system administration tasks that you might encounter. Also, there are tools for
development, graphics manipulation, text processing, and database operations; just about any
user or system-related requirement.
Characteristics of UNIX CONTD
System Libraries: A system library is a collection of software that programmers use to augment
their applications. UNIX comes with quite a large collection of functions or routines that can be
accessed from several different languages to aid the application writer with a variety of tasks. For
example, should the need arise to sort data, UNIX provides several different sort functions.

Well Documented: UNIX is well documented with both online manuals and with many reference
books and user guides from publishers.
UNIX System Architecture

UNIX, like other operating systems, is composed of various functional


components, each dedicated to specific services. It primarily consists of
four major parts: the Kernel, Application Programming Interfaces (APIs),
various tools and utilities, and the shell. The diagram below illustrates the
integration of these individual components within the UNIX system.
The Kernel

The Kernel is the main program that interfaces with all hardware components, supports the
execution of applications, and provides an environment for users. It is the controlling entity of the
system. Generally, the kernel performs the following functions and services:

Interfaces with the computer hardware: the kernel uses modules (software components) called
device drivers to talk directly to hardware-level devices. E.g. it uses serial port drivers, printer port
drivers, keyboard and mouse drivers, video display drivers, sound drivers, and network interface
drivers to talk to the respective hardware.

Provides time-sharing services: The kernel is responsible for providing the resources necessary to
handle multiple users, applications, and other processes in what seems like a concurrent, real-time
fashion. That is, UNIX supports concurrent logins of different users and these users may execute
different applications or software all at the same time.
Kernel Continues
Implements security model: In UNIX all users must be defined on the system before they are permitted
to access or log in to the system, and each user has a particular profile used to track their activities in
the system. Users are not allowed to delete or modify other user’s or system’s files without permission.
APIs
UNIX provides a large number of application programming interfaces (APIs), which help programmers
write applications or tools that help to take advantage of the system. Using UNIX APIs makes it easier
to write programs and helps software to integrate with the system.
The Shell

UNIX provides a mechanism for a user to log in to the system using what is known as a command-
line prompt or shell. The shell is a command interpreter, which takes what the user types in and
executes commands, manipulates files, and so forth on behalf of the user. It thus, provides an
interface between the user, the operating system functions, and ultimately the system Kernel.

Another powerful feature of the UNIX shell is the ability to support the development and execution
of custom shell scripts. The shell contains a mini programming language that provides a lightweight
way to develop new tools and utilities without having to be a heavyweight software programmer. A
UNIX shell script is a combination of internal shell commands, regular UNIX commands, and some
shell programming rules.
GENERAL UNIX COMMANDS

by Olufemi Olaewe
Introduction
Once a user logs into a UNIX system, the default shell prompt appears
The shell simply waits for input from the user.
Some basic shell prompts are shown
below:

User can type in any standard UNIX command, application, or custom script name and the system will
attempt to execute or run the command
Categories of UNIX commands

Generic user-level commands,


Superuser-level commands, and
Built-in shell command
User-Level
User-level commands are those programs that can be run by any user, regardless of their access level or other
user account parameters

• E.g. date, cal, ls, cd commands among others.

• These commands are contained within standard directories such as /usr/bin or /usr/local/bin.
Superuser

Superuser commands are those that require system-level or privileged access to invoke or execute. E.g.
format and shutdown commands.

These commands are normally run only by the system administrator.


Built-In
The built-in shell commands are defined as those functions, which are not part of the UNIX command set, but
instead are interpreted and supported directly by the shell.
Note
A UNIX command may be simple like the date command or may have arguments.
An argument can be an option or a filename.
The general format for UNIX commands is:

command option(s) filename(s)

There is no single set of rules for writing UNIX commands and arguments, but you can use these general rules
in most cases:

1. Enter commands in lowercase.


2. Options modify the way in which a command works.
Options are often single letters prefixed with a dash (-).
Or multiple options set off individually (like -a -b), or, combined after a single dash (-ab).

3. The argument filename is the name of a file that you want to use.

If you don't enter a filename correctly, you may get a response such as "filename: no such file or directory" or
"filename: cannot open."

Some commands, like who, have arguments that are not filenames.
Note contd
1. You must type spaces between commands, options, and filenames.
2. Options come before filenames.

3. Two or more commands can be written on the same command line, each separated by a semicolon (;).
Commands entered this way are executed one after another by the shell.
The ls command
The ls command is used to list files and/or directories within one or more file systems.
The basic syntax includes
ls [options] [file/directory]

To list files and directories stored in the directory you are currently working in simply type ls or ls followed
by option(s). E.g
ls command contd

Here is the information about all the listed columns:


1.First Column: represents file type and permission given on the file.
2.Second Column: represents the number of memory blocks taken by the file or directory
3.Third Column: represents owner of the file. This is the UNIX user who created this file.
4.Fourth Column: represents group of the owner. Every UNIX user would have an associated group.
5.Fifth Column: represents file size in bytes.
6.Sixth Column: represents date and time when this file was created or modified.
7.Seventh Column: represents file or directory name.

Every line in the listing began with d or -. These characters indicate the type of file that is listed.

Other file types besides these two are summarized in the table below:
Basic file management commands
cat command
• The cat command is used to view the content of a file.

• The content of a text file named myfile is viewed as follows using the cat command

wc command
This command is used to count the total number of lines, words, and characters in a file.

2 is the total number of lines in the file, 19 the number of words and 103 the number of characters.

cp command
The cp command is used to copy files in UNIX

mv command
The mv command is used to rename files as follows

rm command
The rm command is used to remove or delete files. The following deletes myfile from the system.
Directory management commands

• A directory is a file used to store other files and related information.

• All files whether ordinary, special, or directory, are contained in directories.

• The directory you find yourself in when you log in to UNIX is your home directory.

• Most of your work will be done in this directory, though you can create subdirectories to organize your files.

• Some of the general directory commands needed to create and manage directories are explained below:
cd command
The cd (change directory) command is used to switch from one directory to another in UNIX.

For example, to move to one’s home directory from another directory, the cd command is used as follows:

~ denotes home directory

To move into another user’s home directory, we use:

To switch to the last directory you visited, then use:


The cd command can also be used to change to any directory in the system

• E.g., the following command is used to change to a directory called bin stored under local, in the usr
directory
mkdir command

This command is used to create new directories.

• To create a new directory called mydirectory in your current directory, then:


mv command

This command is used to rename directories.


For example, to rename directory, mydir to yourdir, the following can be used:
SHELL SCRIPTS

The basic concept of a shell script is to list a set of commands, which are arranged in the order of execution.

A good shell script will have comments, preceded by a pound sign, #,describing the steps.

There are conditional tests, such as value A is greater than value B,


loops allowing us to go through massive amounts of data, files to read and store data,
variables to read and store data, and
a script may include functions.

The above script can be save and made executable using the following commands:

If this script is executed using the ./file_name command, the following output is expected

You might also like