UNIX Operating System
UNIX Operating System
UNIX is a powerful Operating System initially developed by Ken Thompson, Dennis Ritchie
at AT&T Bell laboratories in 1970. It is prevalent among scientific, engineering, and
academic institutions due to its most appreciative features like multitasking, flexibility, and
many more. In UNIX, the file system is a hierarchical structure of files and directories where
users can store and retrieve information using the files.
Multitasking: A UNIX operating system is a multitasking operating system that allows you
to initiate more than one task from the same terminal so that one task is performed as a
foreground and the other task as a background process.
Multi-user: UNIX operating system supports more than one user to access computer
resources like main memory, hard disk, tape drives, etc. Multiple users can log on to the
system from different terminals and run different jobs that share the resources of a
command terminal. It deals with the principle of time-sharing. Time-sharing is done by a
scheduler that divides the CPU time into several segments also called a time slice, and
each segment is assigned to each user on a scheduled basis. This time slice is tiny. When
this time is expired, it passes control to the following user on the system. Each user
executes their set of instructions within their time slice.
Portability: This feature makes the UNIX work on different machines and platforms with the easy
transfer of code to any computer system. Since a significant portion of UNIX is written in C
language, and only a tiny portion is coded in assembly language for specific hardware.
Open Source: UNIX operating system is open source it means it is freely available to all
and is a community-based development project.
Accounting: UNIX keeps an account of jobs created by the user. This feature enhances the
system performance in terms of CPU monitoring and disk space checking. It allows you to
keep an account of disk space used by each user, and the disk space can be limited by
each other. You can assign every user a different disk quota. The root user can perform
these accounting tasks using various commands such as quota, df, du, etc.
UNIX Tools and Utilities: UNIX system provides various types of tools and utilities
facilities such as UNIX grep, sed and awk, etc. Some of the general-purpose tools are
compilers, interpreters, network applications, etc. It also includes various server programs
which provide remote and administration services.
Layer-2: Kernel -
The core of the operating system that's liable for maintaining the full functionality is
named the kernel. The kernel of UNIX runs on the particular machine hardware and
interacts with the hardware effectively.
It also works as a device manager and performs valuable functions for the processes which
require access to the peripheral devices connected to the computer. The kernel controls
these devices through device drivers.
The kernel also manages the memory. Processes are executed programs that have owner's
humans or systems who initiate their execution.
It also keeps a history of the list of the commands you have typed in. If you need to repeat
a command you typed it, use the cursor keys to scroll up and down the list or type history
for a list of previous commands. There are various commands like cat, mv, cat, grep, id, wc,
and many more.
o Bourne Shell: This Shell is simply called the Shell. It was the first Shell for UNIX OS.
It is still the most widely available Shell on a UNIX system.
o C Shell: The C shell is another popular shell commonly available on a UNIX system.
The C shell was developed by the University of California at Berkeley and removed
some of the shortcomings of the Bourne shell.
o Korn Shell: This Shell was created by David Korn to address the Bourne Shell's user-
interaction issues and to deal with the shortcomings of the C shell's scripting quirks.
system22@VirtualBox: ~$ time
system22@VirtualBox: ~$ date
Most of important configuration in Unix is in clear text files, these commands will let you
quickly inspect files or view logs:
Syntax:
system22@VirtualBox: ~$ cat > sample1
This is Sample1
Control +D to exit
Let’s see the file we just created
system22@VirtualBox: ~$ cat sample1
cd – change directory
Syntax:
system22@VirtualBox: ~$ cd dir_name
ex : system22@VirtualBox: ~$ cd bca
• less – an improved tool for viewing text files (better than more command)
Syntax:
system22@VirtualBox: ~$ less sample1
• head – show the first 10 lines of text file (you can specify any number of lines)
Syntax:
system22@VirtualBox: ~$head sample1
• tail – show the last 10 lines of text file (any number can be specified)
Syntax:
system22@VirtualBox: ~$tail sample1
WC:
wc stands for word count. As the name implies, it is mainly used for
counting purpose.
It is used to find out number of lines, word count, byte and
characters count in the files specified in the file arguments.
By default it displays four-columnar output.
First column shows number of lines present in a file specified, second
column shows number of words present in the file, third column shows
number of characters present in file and fourth column itself is the file
name which are given as argument.
Syntax:
wc [OPTION]... [FILE]...
$ cat state.txt
Andhra Pradesh
Arunachal Pradesh
Assam
Bihar
Chhattisgarh
$ wc state.txt
5 7 58 state.txt