What is UNIX?

Maldives Digital Society
digitalraajje
Published in
6 min readFeb 10, 2020

By Vishah

What is UNIX?

UNIX is an operating system which was developed by Ken Thompson, Dennis Ritchie and others at the AT&T Bell Labs on 1970. An operating system is the program that controls all the other parts of a computer system, both the hardware and the software. It allocates the computer’s resources and schedules tasks. It allows you to make use of the facilities provided by the system. Every computer requires an operating system.

Fig: Operating system interfacing hardware

and software components of a system.

UNIX is a multi-user, multi-tasking operating system. Multiple users may have multiple tasks running simultaneously. This is very different from PC operating systems such as MS-DOS or MS-Windows (which allows multiple tasks to be carried out simultaneously but not multiple users).

UNIX is a machine independent operating system. Not specific to just one type of computer hardware. Designed from the beginning to be independent of the computer hardware.

UNIX Philosophy

Make each program do one thing well. Write programs to work together.

Modularity and reusability are the main approaches to software development outlined in the UNIX philosophy. Unix programs follow the concept of DOTAWD or “Do One Thing and Do it Well”. The commands included in UNIX, each perform a minimalistic specific task, but does that task well. Individual commands or programs can be combined to perform complex tasks. This is achieved by having the output of one program or command to become the input of another program, chaining multiple commands together to achieve required tasks at hand. UNIX also provides terse commands and messages to achieve reduced typing and screen output which helps write shorter command statements when chaining commands.

For example following are some of the most commonly used commands in UNIX, each of which has a dedicated function.

grep searches for a word in a given file.

cut extracts columns in a file

sort orders a file, or if a file is omitted, output of another command can be sorted

rm deletes a file

cp copies a file

ps lists running processes

UNIX philosophy rejects complicating or bloating programs with new features. It advocates creating distinct programs for each new job.

Expect the output of every program to become the input of another program. To combine simple tools to perform complex tasks

To chain commands together, UNIX provides “pipe” command (“|”) . The pipe command redirects the output of a command into another one. For example ‘ls’ is a command to list the files and directories in the current directory(or a given path). Man is used to view the help manual of a command. ‘man ls’ will show the full documentation of the use of the ls command in the terminal. ‘head’ command is used to view the first few lines of a given file.

Instead of dumping the whole documentation of the ls command to the terminal, if you want to only view the first few lines of the documentation you can filter the output of ‘man ls’ to the head command using a pipe.

man ls | head

prints the first lines of the “ls” manual

ls command with “-l” option lists all the files in the current folder in long list format.

wc(word count) with “-l” option shows the number of lines in a file.

How to combine these two commands to show the number of files in the current folder?

ls -l |wc -l

As you can see two individual command each with a specific purpose are combined together to perform something completely different.

Why UNIX?

Hardware independence

Operating system code for UNIX is written in C language rather than a specific assembly language such that the operating system software can be easily ported or moved from one hardware system to another. UNIX applications can be easily moved to other UNIX machines. Porting is usually as simple as transfer of the source and recompile.

Even though UNIX was initially managed and developed by AT&T, When later, other vendors forked out their own versions flavours of UNIX portability his a road bump. In the coming decades more UNIX based and UNIX like Operating systems (Like Linux) were created, making it more complex to port programs between these Operating Systems. In the1980s POSIX standard was created to resolve portability issues of these Operating systems. POSIX defines the standards of the interfaces between programs and the operating system. Android, Linux distributions, Free BSD and Mac OS are POSIX compliant Unix Based or Unix Like Operating Systems.

UNIX Components

Unix provides a productive environment for software development, provides a rich set of tools, has a versatile command language and has distributed processing and multi-tasking.

Kernel

The Kernel is the core of the UNIX system which is loaded at system start up (boot). It is the memory-resident control program which manages the entire resources of the system, presenting them to you and every other user as a coherent system. The Kernel provides low level services to user applications such as device management, process scheduling and memory management. It manages priority of programs in the usage of hardware resources.The kernel manages the machine’s memory and allocating it to processes based on priority of the programs used. If the memory cannot cater for the programs that are concurrently run, it manages allocating space from hard disk to act as virtual memory by swapping out low priority programs to the hard disk swap space from the RAM. It schedules the work done by the CPU so that the work of each user is carried out as efficiently as possible. It accomplishes the transfer of data from one part of the machine to another. It also interprets and executes instructions from the shell and enforces file access permissions.

In the traditional definition the Kernel itself can be called the operating system but an Operating system also includes applications like user interface(shells, GUI, tools).

Shell

A shell is a user interface for access to an operating system’s services. Shells can as CLI(Command Line interface) or GUI(Graphical User Interface).In UNIX systems Graphical shell typically consists of X window manager or Wayland compositor. A Unix shell typically refers to a command-line interpreter that provides a traditional CLI interface for UNIX like systems. Whenever you login to a Unix system you are placed in a shell program. The shell’s prompt is usually visible at the cursor’s position on your screen. To get your work done, you enter commands at this prompt.

The shell is a command interpreter; it takes each command and passes it to the operating system kernel to be acted upon. It then displays the results of this operation on your screen.Several shells are usually available on any UNIX system, each with its own strengths and weaknesses.

Different users may use different shells. The default shell supplied by the installation, can be overridden or changed.

The most commonly available shells are Bourne shell (sh), C shell (csh), TC Shell (tcsh) and Bourne Again Shell (bash). Each shell also includes its own programming language. Command files, called “shell scripts” are used to accomplish a series of tasks.

Utilities

UNIX provides several hundred utility programs, often referred to as commands accomplishing universal functions such as editing text files,file maintenance including, moving, renaming, deleting and changing permissions of files,sorting and programming support. These utilities are modular such that single functions can be grouped to perform more complex tasks.

--

--