Unix - Module 1
Unix - Module 1
UNIX is one of the oldest operating systems, which is a multi-user and multi-tasking
system. The UNIX OS is basically written in C programming language. Under UNIX, the
operating system consists of many utilities along with the master control program, called
as the kernel.
The kernel provides services to start and stop programs, handles the file system and other
common "low-level" tasks that most programs share, and schedules access to avoid
conflicts when programs try to access the same resource or device simultaneously.
To mediate such access, the kernel has special rights, reflected in the division between user
space and kernel space. The user interacts with a UNIX system through a command
interpreter known as the shell
1.2 History
In the mid – 1960’s, the Massachusetts Institute of Technology (MIT), Bell Labs, and
General Electric (GE) were trying to develop a time-sharing OS called as Multics
(Multiplexed Information and Computer Services) for GE-645 mainframe. Because of the
complexity of intended OS Multics, they dropped the project.
But, in 1972 few researchers like Dennis Ritchie, Ken Thompson, Brian Kernighan decided
to redo the work in a smaller scale. They initially named it as Unics (Uniplexed Information
and Computer Services), and eventually, it was renamed as UNIX.
1980’s, UNIX became available for commercial purposes apart from earlier scientific
environment. It kept on taking different forms over the years, and in 1990’s many UNIX –
like systems came into existence, such as Linux.
1.3 Architecture
The UNIX system is supported by several simple but useful components. The important
components which embody UNIX OS architecture are discussed here.
Kernel: The kernel is also known as operating system. It interacts with the hardware of the
machine. The kernel is the core of OS and it is a collection of routines/functions written in
C. Kernel is loaded into memory when the system is booted and communicates with the
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 2
hardware. The application programs access the kernel through a set of functions called as
system calls.
The kernel manages various OS tasks
like memory management, process
scheduling, deciding job priorities etc.
Even if none of the user programs are
running, kernel will be working in a
background.
Shell: The shell interacts with the
user. It acts as a command interpreter to
translate user’s command into action. It is
actually an interface between user and the
kernel. Even though there will be only
one kernel running, multiple shells will
be active – one for each user.
When a command is given as input
through the keyboard, the shell examines
the command and simplifies it and then
communicates with the kernel to see that the command is executed. The shell is represented by
sh (Bourne Shell), csh (C Shell), ksh (Korn shell), bash (Bash shell). The relationship between
kernel and shell is shown in Figure 1.1.
Process: A processing a program under execution. Processes are also belonging to separate
hierarchical structure. A process can be created and destroyed. UNIX provides tools to the user
to control the processes, move them between foreground and background and to kill them.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 3
UNIX user can have his own workstation. That is, one can have dedicated CPU with RAM, hard
disk etc for individual purpose. This is also known as desktop PC. Sometimes, many workstations
can be connected to server via network. In such situations each workstation provides a terminal
emulation facility, which will help a workstation to behave as a simple terminal. Now, the
workstation will share the resources (CPU, memory etc) of the server for most of the tasks. Its own
resources are used only for running terminal emulation software.
When the workstation is acting like a terminal (that is, when emulation software is running), then
all files created will be stored in a server and, the programs being run will use server’s memory
and CPU.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 4
The message displayed here indicates the last time the user logged in. The prompt displayed here
is $ followed by a cursor blinking (the underscore_). Various shells like Bourne Shell (bsh), Bourne
again shell (bash), Korn Shell (ksh), C Shell (csh) etc., the prompt is $ for any normal user. For the
administrator, usually the prompt would be %. Some shells show the users current directory as –
[home/ramasatish]
On the other hand, the Linux systems will display some informative prompts instead of % or $.
The information at the prompt will be like machine name, username and current directory. For
example,
[ramasatish@ramasatish-virtual-machine]$
Logging out: It is a regular practice to log out of the system when the user finishes all the jobs.
The procedure for logging out of the system will be depending on the shell used. The appearance
of the text ‘login:’ confirms that the user has successfully logged out.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 5
Unix is a multitasking system, wherein a single user can run multiple jobs concurrently. A
user may edit a file, print a document on a printer and open a browser etc – all at a time.
In multitasking environment, a user can see one job running in the foreground and all
other jobs run in the background. The jobs can be switched between background and
foreground; they can be suspended or terminated.
Unix is a collection of few hundred commands, each of which is designed to perform one
task.
More than one command can be connected via the | (pipe) symbol to perform multiple
tasks. The commands which can be connected are called as filters because, they filter or
manipulate data in different ways.
Many Unix tools are designed such a way that the output of one tool can be used as input
to another tool. For this reason,
UNIX commands do not generate lengthy or messy outputs.
If a program is interactive, then user’s response to it may be different. In such situations,
the output of one command cannot be made as input to another command. Hence, UNIX
programs are not interactive.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 6
Unix contains diverse set of applications like text manipulation utilities, compilers and
interpreters, networked applications, system administration tools etc.
The Unix kernel does many tasks with the help of these applications. Such set of tools are
constantly varying with every release of UNIX.
In every release, new tools are being added and old tools are either removed or modified.
Most of these tools are open-source utilities and the user can download them and
configure to run on one’s machine.
1.5.5 Pattern Matching
Unix has very sophisticated pattern matching features. The character like * (known as a
metacharacter) helps in searching many files starting with a particular name.
Various characters from a metacharacter set of Unix will help the user in writing regular
expressions that will help in pattern matching.
1.5.6 Programming Facility
The Unix shell is a programming language as well. It provides the user to write his/her
own programs using control structures, loops, variables etc. Such programs are called as
shell scripts.
Shell scripts can invoke Unix commands and they can control various functionalities of
Unix OS.
1.5.7 Documentation
Unix provides a large set of documents to understand the working of every command and
feature of it.
The man command can be used on an editor to get the manual about any Unix command.
1.6.1 date
The date command in UNIX is used to display the current date and time of the system. The UNIX
system maintains an internal clock that runs continuously. When the system is shutdown, the
battery backup keeps the clock ticking. This clock actually stores the number of seconds elapsed
since 1st January 1970. A 32-bit counter store these seconds and it is expected to overflow
sometime in 2018.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 7
The format of the date command is “Day Month date hr:min:sec IST year”. For example –
$date
Mon Jun 30 11:35:32 IST 2017
This command will display the output as shown above, and will not allow the user to modify
the current system date. When the system administrator uses the same command, apart from
displaying the date, it allows to modify the date and time. This is possible because of the privileges
given to system admin.
Suitable format specifiers can be used as an argument to date command to get the date/month/year
etc. in required format. The format specifier is preceded by a + symbol, followed by the % operator
and a single character describing the format. Following are some of the formats –
To display only the month, one can use +%m as a specifier. For example,
$date +%m
10 //indicates October.
To display month name, use +%h as below –
$date +%h
Oct
+%d for day of month (1 – 31)
+%y for last two digits of the year
+%H, +%M and +%S indicates hour, minute and second respectively.
One can combine more than one option by enclosing them in double quotes, and keeping +
symbol outside the quote. For example, combination of month and month name –
$date +"%h %m"
Oct 10
1.6.2 passwd
This is the command used for changing the password of a user. When this command is entered in
the terminal, the system will ask for the existing password. After entering the current password
correctly, the system asks for new password to enter. The new password entered must satisfy the
rules framed for proper password in that system. Then system will then ask for reentering the
password for confirmation purpose. When everything goes correctly, the $ prompt is returned. Next
time, when this user logs in, he/she has to give the newly set password. The following is the
example showing working of passwd command in Linux.
[ramasatish@server4 ~]$ passwd
Changing password for user ramasatish.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 8
One can observe that here there are two files and two directories under the current directory. The
ls command has many other options and usage which will be discussed in later chapters.
1.6.4 mkdir
This is the command used to create a new directory. Directories can be used to have a collection
of files under a common name.
$mkdir docs
$_
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 9
The mkdir command has created directory viz. docs. But, the command has not shown any output,
but just displays the prompt. Many a times, UNIX commands do not display any output, but does
the job internally. Here, mkdir has created the directory and that can be confirmed using ls
command. Note that, UNIX internally treats a directory also as a file.\
1.6.5 pwd
Present Working Directory can be displayed using the command pwd. For example –
$pwd
/home/satishkvr
The above output indicates that there is a directory with your login name, and it is within home
directory. In UNIX, when a new user account is created, a directory is automatically created with
that login name.
1.6.6 cd
To move from current working directory to a new directory, the cd (change directory) command is
used. After using cd command, the pwd command can be used to verify the new location. For
example,
$cd sem1unix
$pwd
/home/satishkvr/sem1unix
The above output is the pathname of current working directory starting from the root directory /.
1.6.7 echo
The basic job of echo command is to display the string passed to it as an argument. For example,
$ echo hello
hello
The echo command can be used to evaluate a variable given to it as an argument. For example,
$ x=5
$ echo $x
5
Note that, here, to initialize a variable, we will just use variable name. But, to evaluate and display
its value, the $ symbol must be attached with the variable name. The output of echo command can
be used to create a new file as well. For example,
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 10
1.6.8 wc
The command wc is used for counting number of lines (in fact, total number of new-line
characters), words and characters in a file. For example –
$wc file1
1 2 12 file1
The above output indicates that file1 contains one line, two words (Hello and World) and 12
characters (including space and new-line character).
1.6.9 cal
This command is used to display the calendar of current month. Various arguments can be given
to cal command as listed below –
$cal Dec 2017 : Displays December month calendar of the year 2017
$cal 2017: Displays the calendar for all months of 2017.
For example,
satishkvr@ubuntu:~/sem1unix$ cal
October 2019
Su Mo Tu We Th Fr Sa
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
1.6.10 calendar
This command is a useful in setting reminders. It is available only in UNIX, but not in Linux. A
user has to create a file named calendar with all the tasks he would like to remember. Then, when
this command is used, it invokes all the tasks listed for today (current system date) and
tomorrow. While creating a task list in a file, one has to be careful about the date format that can
be recognized by the system. Consider an example –
$cat calendar
Meeting with principal on Oct 23
October 24 – call for staff meeting
Give notes to students on Oct 24
Car service – Oct 23, 2017
October 24 – call for staff meeting
October 25 – Guest Talk at BMS Engg. Colleg, Birthday celebration
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 11
Here, a file has been created with a name calendar and with some few lines of contents. Now,
assume that today is October 24, 2019 and we are running the command as –
$calendar
Meeting with principal on Oct 24
October 24 – call for staff meeting
Car service – Oct 25, 2019
October 25 – Guest Talk at BMS Engg. Colleg, Birthday celebration
It has displayed the output containing the tasks to be done on 24th and 25th October 2019. Observe
that, it didn’t display one task mentioned as ‘Oct 24th’. Because, it is not in a recognizable format
for the system.
Note that, by default, the calendar command assumes the current year, when the year is not
mentioned in the file. Also, when the current date is a Friday, then it displays the activities of
Monday (the next working day), including the weekend days - Saturday and Sunday.
1.6.11 bc
UNIX provides two types of calculators – a graphical (GUI) calculator (similar
to the one available in windows OS) and a character based bc command. A visual
calculator can be available using xcalc command and it is available only on X
Window system, but not on command-line based terminals.
The calculator available through bc command is a very powerful, but sadly a most neglected tool
in UNIX. When bc command is invoked without any argument, it does nothing but waits for the
input from the keyboard. Once the job is done, ctrl+d has to be pressed to release the command
and to get a prompt. The usage of bc command is illustrated here with examples.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 12
16
9
[^d]
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 13
Here, pts/1 is the name of the terminal. The term pts stands for pseudo-terminal slave. Most of
the UNIX/Linux systems have software implementation as an interface to interact with real
terminal. It is called as pseudo-terminal or pseudo-teletype represented by pty. The pts is a slave
part of pty.
The header option –H can be used along with –u option to get more information on the who
command.
$who –Hu
NAME LINE TIME IDLE PID COMMENT
root :0 2007-01-12 04:49 ? 5595
satishkvr pts/1 2007-01-13 05:39 . 24081 (172.16.4.205)
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 14
Here, first three columns are same as before. The fourth column IDLE indicates from how long the
user is idle. The dot (.) indicates the respective user was active in the last one minute. The question
mark (?) indicates that the user is idle from quite a long time, which is unknown. The fifth column
PID (process identifier) will be discussed in later chapters. The comment line indicates some
special comment, if any. In the above example, for the user satishkvr, it is showing the IP address
of the machine.
It is possible to have multiple user names for a single user. So, sometimes, a user would like to
know who he/she is – that is, with which user name he/she logged in. For this purpose, who am i
command is used. For example,
$who am i
satishkvr tty01 Sept 04 11:11
The additional terms am i used with who are known as arguments. The arguments change the
behavior of UNIX commands and there are many UNIX commands with arguments that will be
discussed in later chapters.
1.6.13 tty: Knowing terminal name
The command tty (teletype) is used to know name of the terminal. For example,
$tty
/dev/tty01
The above statement indicates that tty01 is the name of the terminal and it is within the
directory dev. The dev is under root directory.
NOTE that, UNIX treats all devices as files, and tty01 is one of the files under file system. In
UNIX, just like users, even terminals, disks and printers also have the name and all these are treated
as files. Even the commands are also files in UNIX. Some the systems may display the statement
as below when tty command is given –
$tty
/dev/pts/1
Here, pts/1 is the name of the terminal.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 15
echo $SHELL
/bin/bash
Here, bash is name of the shell stored in bin folder. In UNIX, all commands are files and shell is
also a file. Shell variables have values associated with them just like programming variables. The
echo command is used here to evaluate the value of the variable by using $ symbol attached with
SHELL.
Another variable TERM is used for knowing type of the terminal being used. Terminal type or
emulation specifies how your computer and the host computer (server) exchange the information.
Terminal type of one’s computer has to be set properly so that both terminal and the server can
communicate in a same way. Otherwise, your terminal will not have enough information to perform
actions like clearing the screen, moving the cursor, placing a character etc.
$echo $TERM
vt220
The type of terminal may be vt100, vt220, xterm etc. Each one has different meaning and feature,
which is beyond the scope of this study.
1.6.15 stty
This command is used to set terminal characteristics. The terminal is a device with
which user communicates. Each terminal is configured differently depending on the
user’s choice. For example, a user can decide
what should be the abort key (like Ctrl+c or Delete key etc),
whether a character has to be deleted or not when backspace key is used
what should be the end-of-file character when cat command is used (like Ctrl+d or
Ctrl+a etc)
The stty command helps the user in setting all such characteristics and also to revoke
existing characteristics.
NOTE that the setting users does may not be effective in some terminals (especially on
Linux machines). The command stty shows the output as given below –
$stty
speed 9600 baud; line = 0;
-brkint -imaxbel
Initially it displays baud rate of the terminal as 9600. The number of characters that a terminal can
transmit per second is known as baud rate. The line indicates the line discipline of Unix terminal.
It does the input processing in the kernel. The brkint indicates that whether or not (with – or without
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 16
– ) an interrupt signal has to be generated when there is a break in the script. The imaxbel indicates
to beep and do not flush a full input buffer on a character.
The –a (all) option with this command will display the current settings as shown below –
$stty –a
speed 9600 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\;
erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch =
<undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
ixon –ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0
bs0 vt0 ff0 isig icanon iexten echo echoe echok -echonl -noflsh -xcase
-tostop –echoprt echoctl echoke
In the first line, we can see number of rows (24) and number of columns (80) that a terminal can
display at a time. After this, there are many settings, which are shortcut keys for certain tasks. In
this terminal, the interrupt key is Ctrl+C, the erase character is Ctrl+?, the kill character is Ctrl+u,
the end-of-file is Ctrl + d etc. There are some keywords in the above display, where some are with
– (hyphen) symbol and some without that. If an option is without – (hyphen) symbol means, it is
turned on. One can use stty to on or off these options. Some of the examples are discussed here.
Whether backspacing should erase character (echoe): You might have observed that in some
of the terminals, the backspace key will not erase the characters. This is the behavior of echoe
option available in stty command. If you want the backspace to remove the character, use –
$stty echoe
If you want the backspace to not to remove a character, use –
$stty –echoe
NOTE that, this option is not effective in Linux. Entering a Password through a Shell Script
(echo): The option echo has to be set to let shell programs to accept a password – like string
(invisible characters). By default, the option is turned on, but one can turn it off using –
$stty –echo
After using this command in a terminal, every character/text what you write will be invisible in
terminal. To make characters visible, set as –
$stty echo
Note that, this sentence is invisible, but subsequent commands will be visible.
1.6.16 uname
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 17
The command uname is a short-form for UNIX name, which displays the details like name and
version of the machine and OS currently running. It can display various details based on the option
given to it as an argument. Consider following situations:
$uname
Linux
The command without any options displays the name of underlying OS.
$uname –a
Linux server4 2.6.18-128.el5xen #1 SMP Wed Dec 17 12:01:40
EST 2008 x86_64 x86_x
This has displayed details like kernel name, node name, kernel release, kernel version etc.
$uname –n
server4
When your system is connected to network, it prints the name of the machine in network. This
name is required while copying the files from remote machine using ftp command.
1.6.17 printf
The printf command can be used as an alternative to echo command. Several usages of printf are
explained here with suitable examples.
$printf “Hello World”
Hello World$_
Note that, printf has printed the string and the prompt got displayed immediately after the string
without inserting a newline character (Whereas, echo adds a newline character). To have a newline
character, one can use the escape sequence \n as below –
$printf “Hello World\n”
Hello World
$_
printf can be used without double quotes. But, printf terminates when a space is encountered.
$printf Hello World
Hello$
Note that the term World didn’t get printed here. Just like printf() function of C language, in UNIX
also, printf command can use format specifiers like %s, %d, %f, %o, %x etc. And, the values of
variables can be displayed along with printf command. For example,
$printf "Current shell is %s \n" $SHELL
Current shell is /bin/bash
Observe that, there is no comma separator between the string to be printed and the variable. The
format specifiers can be used to convert the numbers as below –
$printf "Value of 138 is %x in Hexa and %o in Octal\n" 138 138
Value of 138 is 8a in Hexa and 212 in Octal
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 18
1.6.18 script
The script command is used to record the session in a file. When you have are doing some
important work, and would like to keep a log of all your activities, you should use script command
immediately after logging in. For example,
$script
Script started, file is typescript
$
Now onwards, whatever you type, that will be stored in the file typescript. Once the recording is
over, you can terminate the session by using exit command.
$exit
Script done, file is typescript
$
To view the file typescript, one can use cat command. Note that, the usage of script command
overwrites any existing file with name typescript. If you want to append the new content to
existing file, then use –a as below –
$script –a
Now, the previous typescript will be appended with the activities of this session. If you want to
create your own file instead of typescript file, then give the required filename as –
$script mylogfile
Now, the activities of this session will be stored in the file mylogfile.
NOTE that, some activities like the commands used in the full-screen mode like vi editor will not
be recorded properly when we record session using script command.
1.6.19 spell and ispell
The spell command is used to check the spelling in a text file. When the name of a file is given an
argument to this command, it lists out all the mistakes (words without proper meaning as per the
understanding of UNIX). To understand this command, let us first create a file as below –
$cat >test.txt
hello hw are yu?
Im doin fine
Now, apply spell command on the file test.txt as shown –
$ spell test.txt
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 19
doin
hw
Im
yu
One can observe that the words with
spelling mistakes have been
displayed in the order. Now, if you
want to correct these words, ispell
command can be used. ispell is
actually an interactive editor, which
displays various suggestions for a
mistaken word. Then, user has to
choose one of the possible suggestions listed and the mistaken word will be replaced by the
corrected word. For example,
$ispell test.txt
The command tput uses the argument smso to render the text in reverse combination of background
and foreground colors. The term smso indicates “Start Mode Stand-Out”. Assume that background
color of the terminal is white and foreground color of the text is black. When the argument smso
is set using tput, the further entries in the command prompt will appear as – background with black
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 20
color and foreground text with white (That is reverse of the previous settings). To stop this setting,
the argument rmso (Reset Mode Stand-Out) is used. For example,
$tput smso
$echo “hello world” //foreground background colors will be reversed
hello world
$tput rmso //becomes normal
1.6.21 cat
It is a short-form of the term concatenate. This command is basically used for viewing the contents
of a file. But, it has many other usages like creating a file, joining more than one file etc. Here, few
of the usages of cat command are discussed.
To create a new file: Following is an example to create a new file –
$ cat >test
hello how are you?
I'm doing good.
what about you?
[^d]
$
When cat command is used with > operator and the file name, the cursor waits for the user to enter
the contents of the file. Once the entry is over, user will press ctrl+d to exit. This action would
create a file with a specified name and the contents. Note that, if the file with that name already
exists, it will be overwritten by new contents.
To display contents of a file: The cat command is used with filename to display the contents
of the file as shown below –
$cat t1
This is first file
$
Display Multiple files at once: The cat command can be used to display contents of multiple
files by passing different filenames as arguments through space separated list. For example,
$ cat t1 t2
This is first file
This is second file //content of the file t2
$
Giving line Numbers: The contents of any file can be displayed along with line number by
using –n option as below –
$cat –n test
1 hello how are you?
2 I'm doing good.
3 what about you?
$
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 21
Use redirection operator to copy the contents of one file to other: A duplicate copy of one
file can be created using redirection operator as below –
$cat t1 > t3
$ cat t3 // check the contents of t3
This is first file
$
Now, a new file t3 got created and the contents of t1 are copied into t3. Note that, if the file with
name t3 already existed, then it will be overwritten.
Append contents of one file at the end of other file: Using the >> operator, the contents of
one file can be appended at the end of other file as shown below –
$ cat t1 >>t2
$ cat t2 //display the contents of t2
This is first file //original contents of t1
This is second file //appended portion from t2
$
Creating single file with the contents of multiple files: One can create a new file which
contains the contents of more than one file as below –
$ cat t1 t2 > t4
$ cat t4
This is first file
This is second file
$
1.6.22 touch
This command is used to create one or more empty files. These files can be then filled with
required content through vi editor. Usage is as follows –
$touch t1 t2 t3
$
Now, 3 files with names t1, t2 and t3 got created and that can be verified by using ls command.
Shell programs run in interpretive mode – one statement at a time. That is, the output of every line
is displayed immediately after executing that line. Shell will not wait till the end of the program.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 22
Also, there will not be any intermediate files (like .obj or .exe etc) for a shell script when you run
it. Since shell scripts are interpreted codes, they run slower compared to higher–level languages.
Still, shell scripts are powerful because external UNIX commands mingle with internal constructs
of shell very easily.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 23
and parent shells belong to the same type by default, one can provide a special interpreter line in
the first line of the script to specify the type of shell of your script.
Consider the first shell program, with the name Shell1.sh as given below. One can use vi
editor to create this file.
#!/bin/sh
#My first shell program
echo "Today's date: `date`"
echo "This month's calendar:"
cal `date "+%m 20%y"`
echo "my shell is: $SHELL"
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 24
a script in executable mode. For example, in the above example, before using chmod
command, one can use –
$sh Shell1.sh
to run this script. Here, the usage of sh make the underlying parent shell to spawn a child shell
and that child is being used to run the script. Now, the interpreter line is being ignored by shell.
But, the above type of usage has a disadvantage as well. As we know, there is a slight difference
between the syntax of various shell scripts. That is, some of the commands in bash, ksh, csh
etc may not be compatible with each other. Now consider a situation – you are writing a script
in ksh format and you have given interpreter line accordingly. Assume that the underlying shell
in your system is bash. Now, if you directly use sh to run a script, you may get unexpected
results or sometimes errors as well. Because, you are trying to run a ksh script using bash shell,
which is not possible always. Hence, it is always better to have an interpreter line, then
changing the script to executable mode and then to run a script.
Explanation about the program Shell1.sh:
The first line in the program (after an interpreter line and a comment line) is –
echo "Today's date: `date`"
Here, a string within double quotes is being passed to echo command. But, observe the term
`date` within that string. The symbol ` (in the keyboard, it is at the left of key 1, and it is along
with another symbol tilde ~) is known as backquote or backticks. The command given within a
pair of backquote in UNIX is known as command expansion (or command substitution). The
command expansion will execute the underlying command (that is, the command given within
backquotes) and the output is substituted at that place itself.
Hence, in the above line the command date is executed and its output is made as a part of the
string. Thus, we will get the output as expected. Some of the shells use the $ symbol and a pair of
brackets as an alternative to backquotes for command expansion purpose. For example, one can
use the following line to get the same result as shown in the script –
echo “Today’s date: $(date)”
The third line in the script is -
cal `date "+%m 20%y"`
In the section 1.6.1, we have seen date command and its options like %m and %y. These are
given as arguments to date command to get month number and last two digits of the year.
Then the output is substituted and passed as option to cal command to get the calendar for
respective month of the year.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 25
In the last line of the script, a PATH variable $SHELL is used to display the type of shell
being used.
1.7.3 read
The read statement is the internal tool of the shell for taking input from the user. This will help the
scripts to become interactive. Consider the following example
#!/bin/sh
#Illustration of read statement
echo "Enter your name:"
read fname
echo "Hello $fname"
When you run this script, the output would be –
Enter your name:
Satish
Hello Satish
Observe that, when the statement read fname is encountered, the script pauses to receive the user
input. After getting the input, it continues with the next line in the script. The read statement can
be used to read multiple variables in a single line as below –
read fname lname
Here fname and lname are different variables. The input has to be given with a space between
two values. Note that, if the numbers of inputs are less than the number of variables, then the
leftover variables will not be assigned any value. Whereas, if number of inputs are more than the
number of variables, then the extra inputs are concatenated and assigned to the last variable.
Consider following examples –
Ex1:
read fname lname #read two variables
Rama #give only one input
echo “$fname $lname” #try to display both variables
Rama #displays first variable, second is empty
Ex2:
read fname #read one variable
Rama Satish #give two inputs
echo “$fname” #display one variable
Rama Satish #displays both values
1.7.4 Command Line Arguments
Arguments can be passed to a shell script through the command line, while running the script. Such
command line arguments are assigned to special variables known as positional parameters. The
name of the program itself is treated as first argument and stored in positional parameter $0. Further
arguments given by the user are sequentially stored in parameters $1, $2 and so on. Note that, these
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 26
are not called as shell variables (because, name of shell variables starts with a character). Some of
the special parameters used by the shell are listed in Table 1.1.
Table 1.1 Special parameters used by Shell
Shell Significance
Parameter
$0 Name of the executed command (that is script file name – in most of the cases)
$1, $2 etc. Positional Parameters representing command line arguments
$# Total number of arguments specified in command line (excluding file name)
$* Complete set of positional parameters as a single string
“$@” Each quoted string treated as a separate argument
$? Exit status of last command
$$ PID of the current shell
$! PID of the last background job
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 27
Here, the date command is executed within echo. As, it could execute successfully, the exit status
parameter will be obviously 0.
Ex2: File not found error
$cat test; echo “Exit Status: $?”
cat: test: No such file or directory
Exit Status: 1
Here, we are trying to open a file test, which actually does not exist. So, the appropriate error
message is displayed. Hence, the exit status parameter will now contain 1.
Ex3: Command not found error
$try ; echo “Exit status: $?”
bash: try: command not found
Exit status: 127
Here, we are giving some random text try as if it is a command. Hence, no such command exists,
there will be a command not found error. Now the exit status is 127. Note that the
number 127 indicates – either the command not found; or the command is found, but the library
required to run that command is not found in the specified path.
NOTE: Knowing the exit status of a command is very essential in real time programming.
Because, one may need to take separate action based on successful/unsuccessful execution of a
particular command.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 28
condition. It returns either true or false exit status. Hence the result of test command can be known
using the shell parameter $?, which stores the exit status of previous command. The uses of test
command are:
Comparing two numbers
Comparing two strings
Comparing single string with a null value
Checking file’s attributes
Here, we will discuss comparison of two numbers. Consider the following example –
$ x=5; y=7
$ test $x –eq $y
$ echo $?
1 #Not equal
$ test $x –lt $y; echo $?
0 #5 less than 7 is true
Observe that when x and y are compared for checking equality, the result is 1 – a non-zero number
indicating false; whereas, x is less than y and hence the result is true (indicated by zero). A pair of
square brackets [ ] also does the similar job that of test for evaluating numbers. For example,
$ [ 10 –lt 20 ]
$echo $?
0 #10 less than 20 is true
NOTE that, there must be a space between a square bracket and the operand. Otherwise, shell
will throw an error.
1.7.8 The if Condition
One of the important requirements in programming is conditional structures. In shell programming,
the conditional construct if can be used in the following ways –
if command is successful if command is successful if command is successful
then then then
execute commands execute commands execute commands
fi else elif command is successful
execute commands then
fi execute commands
elif command is successful
then
…………….
else
……………..
fi
Consider the following example to illustrate if statement.
#!/bin/sh
#Illustration of if statement
x=5
y=10
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 29
if test $x -lt $y
then
echo "$x is less than $y"
else
echo "$y is less than $x"
fi
if [ $x -ne $y ]; then
echo "$x and $y are not equal"
fi
Output:
5 is less than 10
5 and 10 are not equal
1.7.9 The Logical Operators && and ||
The shell script allows the user to use two logical operators && and || for combining more
than one conditions/commands. Syntax:
cmd1 && cmd2: The cmd2 is executed only if cmd1 is true. If both cmd1 and cmd2 executed
successfully, then the exit status would contain zero, otherwise some nonzero number. For
example,
Ex1:
$ a=10
$ b=10
$ test $a -eq $b && echo "equal"
equal
$ echo $?
0
Here the values of a and b are equal. Hence, the second command echo "equal” got executed. The
exit status is found to be zero indicating successful execution of both the commands.
Ex2.
$ a=10
$ b=20
$ test $a -eq $b && echo "not equal"
$ echo $?
1
Observe that value of a and b are different. Hence, the first command
test $a -eq $b
itself is false. So, the second command will not be executed. And, the exit status is found to be 1
indicating false.
cmd1 || cmd2: If any one of cmd1 and cmd2 executes successfully, then the exit status will
contain zero.
Ex1:
$ a=10
$ b=20
$ test $a -eq $b && echo "equal"
equal
$ echo $?
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 30
0
Here the values of a and b are not same. Still, we are checking the equality. In fact, the command
test $a -eq $b results in false. Still, because of OR (||) operator, the second command
echo "equal" gets executed.
1.7.10 case
The case statement in shell is similar to switch – statement in C language. When there is a
possibility that the statement matches an expression for more than one alternative, we use case
statement. It is useful for multi-way branching. The general syntax is –
case expression in
pattern1) commands1 ;;
pattern2) commands2 ;;
pattern3) commands3 ;;
…….
esac
The case matches expression with pattern1. If they match, then commands1 will be executed. If
the match fails, then pattern2 is compared and so on. Here commands1 etc may be one or more
commands. Each command list is terminated by a pair of semicolons (similar to break in C
language). And, entire case construct is ended with esac (the reverse of case).
Consider the following shell script :
#!/bin/sh
#Menu driven script to illustrate case
echo " MENU \n 1. List of files \n 2. Display date \n 3. Users of
system 4. Quit \n Enter your option: "
read choice
case "$choice" in
1) ls -l ;;
2) date ;;
3) who ;;
4) exit ;;
*) echo "Invalid option"
esac
Output:
MENU
1. List of files
2. Display date
3. Users of system
4. Quit
Enter your option: 2
Tue Jan 30 09:59:46 IST 2007
In the above example, the multi-line echo command uses –e option to enable escape sequences like
\n. The script displays various options as shown in the output. Based on the user’s choice, the
respective option is matched using case statement to execute respective block of code. The last
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 31
pattern in the case is *), which is used only when all previous options fails (similar to default
keyword in switch-case of C language). Note that a pair of semicolons is not necessary for this last
option.
The case can be used in following ways as well:
Matching multiple patterns: More than one pattern can be combined to perform a specific
action using case. For example, consider the following code snippet:
echo “Do you want to continue? (y/n):”
read ans
case “$ans” in
y|Y) ……… ;; #do something
n|N) exit;;
esac
Here, when user would like to continue, he/she may press y or Y (lower case or upper case
letter). So, the | symbol is used to combine both the patterns. In the same way, n or N is used.
Using wild-cards with case: String matching features using wild-cards is possible with case
in shell script. The metacharacters like * and ? etc can be used to match strings. For example,
echo “Do you want to continue? (yes/no):”
read ans
case “$ans” in
[yY][eE]*) ……… ;; #do something
[nN][oO]) exit;;
esac
Here, user can give the input for ans in any combination of uppercase and lowercase letters. That
is, ans can be one among: Yes, yes, yEs, YEs etc. Similarly, a ‘no’ can be given as No, nO, NO,
no.
1.7.11 expr
The shell does not have computing features. For the evaluation of expressions, it has to use the
expr command. It can perform arithmetic operations on integers and manipulate strings up to some
extent. As it is not a shell statement, instead a stand – alone UNIX command, its usage in shell
script will slowdown the operation. It can perform the basic arithmetic operations – addition,
subtraction, multiplication, division and modulus (remainder after division). Consider the
following example –
$ x=3 y=5
$ expr $x + $y #note the space before and after +
8
$ expr $x - $y
-2
$ expr $x \* $y #the * used with \ as escape sequence
15
$ expr $y / $x
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 32
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 33
In the above example, the menu options are repeatedly shown to the user until he/she chooses to
quit. So, in a single run of the script, one can choose multiple menu options one after the other.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 34
1.7.14 until
The until statement is a complement of while loop. Here, the block of statement is executed until
the condition remains false. For example, consider the following shell script –
#!/bin/sh
#Illustration of until loop
a=0
until [ $a –gt 3 ]
do
echo $a
a=`expr $a + 1`
done
Output:
0
1
2
3
1.7.15 for
It is very important to note that (especially those who know higher programming languages) the
for loop in shell script is NOT same as that in other languages. One can neither
increment/decrement the values, nor specify the condition to be met. Instead, it just iterates over
the elements in a list. A set of commands are executed until the list gets exhausted. The syntax is:
for variable in list
do
execute commands
done
Consider an example –
$ for x in 1 5 10 4 # list has 4 strings
> do
> echo “Value of x is $x” # executed 4 times
> done
Value of x is 1
Value of x is 5
Value of x is 10
Value of x is 4
Here, the list contains four strings 1, 5, 10 and 4 (note that, they are treated as strings, not as
integers). Each item in the list is assigned to variable (here x) and echo command is executed.
Ex: Write a shell script to find sum of numbers provided through command line. sum.sh
#!/bin/sh
#sum of numbers given through command line
sum=0
for x in $*
do
sum=`expr $sum + $x`
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 35
done
echo “Sum = $sum”
Output:
While running this script, give command line arguments similar to –
$ sh sum.sh 10 20 30
Sum=60
1.7.16 “$@”
We have observed earlier that $* is used to list out all the arguments given via command line. In
the script sum.sh given in previous section, it is observed that a string separated by space is treated
as a different argument by $*. But, sometimes we need text within double quotes separated by
space to be treated as single string. In such situations, $@ is used.
The $@ will treat the text given in double quotes as one single string. To do that, $@ itself has to
be enclosed in double quotes as “$@”.
Consider the script given below –
#!/bin/sh
#illustration of $@
echo "The command line arguments are:"
for x in "$@"
do
echo $x
done
Output:
While running this script, give command line arguments similar to –
$sh cmdArg.sh "MCA01" "MCA02" "MCA03"
The command line arguments are:
MCA01
MCA02
MCA03
Observe that, the arguments are given within double quotes. And each argument contains string
involving space in between. If $* would have used in the above script, the shell would treat MCA01
as separate string and so on.
1.7.17 set And shift: Manipulating the Positional Parameters
To extract a field from single line output statements, we have filters like grep, head etc. (will be
discussed in later chapters). But, there is an internal command in UNIX viz. set. This command
assigns its arguments to positional parameters like $1, $2 etc. Also, it assigns roper values to $*
and $# as well. For example,
$ set 13 45 32
$ echo “Argument one:$1, Argument 2:$2, Argument 3:$3”
Argument one:13, Argument 2:45, Argument 3:32
$ echo “There are $# number of arguments”
There are 3 number of arguments
Now, this feature of set command can be used in commands like date. For example,
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 36
$set `date`
$echo $*
Sun Oct 29 08:57:52 IST 2017
$echo $1
Sun
$echo $3
29
$ echo “Today’s date is $2 $3, $6”
Today’s date is Oct 29, 2017
Shifting Arguments towards left: The shift command
We have seen that in many of the scripts, the first argument ($0) is a filename. If we don’t want
this to happen, we can shift the argument towards left using shift command. This will transfer the
contents of a positional parameter to its immediate lower numbered positional parameter. When
shift is called once, $2 will become $1, $3 will become $2 and son on. For example,
$set `date`
$echo $1 $2 $3
Sun Oct 29
$shift
$ echo $1 $2 $3
Oct 29 08:57:52
$shift 2 #shifting two positions at a time
$ echo $1 $2 $3
08:57:52 IST 2017
1.8 REDIRECTION
Usually UNIX commands generate some output or error message on to a terminal, and require
input from the terminal. In the context of redirection, the word terminal indicates the screen, display
or keyboard. The activities related to terminal are done through 3 files viz.
Standard Input – The file (or stream) representing input, which is connected to keyboard
Standard Output – The file (or stream) representing output, which is connected to display
Standard Error – the file (or stream) representing error messages that originate from the
command or shell. This is also connected to the display.
These special files are actually streams of characters which many commands see as input and
output. A stream is a sequence of bytes. When a user logs in, the shell makes these three files
available representing three streams. The files are closed when the command completes execution.
Even though the shell associates each of these files with a default physical device, this association
is not permanent. The shell can easily unhook a stream from its default device and connect it to a
disk file the moment it sees some special characters in the command line. The user has to instruct
the shell to do what by using symbols like > and < in the command line. These three files are
discussed in detail in the following sections.
1.8.1 Standard Input
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 37
Here, when we wc command and press enter, it waits for keyboard input as no filename is
provided. We have given some 3 lines of text and then pressed ctrl-d. Then it displays the
output (3 lines 14 words and 71 characters). In fact, the wc command is reading from
standard input file here. The shell can reassign or redirect the standard input file to a disk file
using < symbol as shown –
$ wc < sample.txt #existing file containing above 3 lines
3 14 71
Here, the wc command reads the sample.txt and gives the input. The working of this
command is explained here –
1. On seeing the < symbol, the shell opens the disk file sample.txt for reading
2. Shell unplugs the standard input file from its default source and assigns it to sample.txt
3. wc reads from standard input which has earlier been reassigned by the shell to sample.txt
Note that, wc has no idea where the stream came from, and also it is not even aware that the shell
had to open the file sample.txt on its behalf.
NOTE:
1. When < is used, the shell is opening a file and the command is not aware of that. But, when
filename is used directly without < symbol, then the command itself will open a file and does the
job.
2. In the above discussion, the example of wc command is taken. But, same explanation holds
good for other commands like cat as well.
3. It is possible to take input from both standard input as well as file. While taking input from
multiple sources, the – symbol has to be used to indicate the sequence of taking input. For
example,
$cat – test
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ
Module 1: UNIX Shell Programming (Open Elective – 18MCA12) 38
The above command takes input from standard input and then from the file test.
$cat test – test1
This line takes input from file test, and then from standard input and finally from the file test1.
By: Rama Satish KV, Asst Professor, RNSIT, B’lore. For latest updates visit: http://shorturl.at/ainTZ