0% found this document useful (0 votes)
32 views

Unix and Shell Programming

Unix is an operating system that manages hardware resources and provides common utilities and services. It was first created at Bell Labs in 1969 and became widely popular due to its portability, multi-user capabilities, and organized file system. The core of Unix is its kernel which controls processes and resources, while shells are programs that interpret commands from users and work with the kernel to execute them. Common Unix commands allow users to view system information, manage files and directories, and perform other tasks.

Uploaded by

Melvin John
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Unix and Shell Programming

Unix is an operating system that manages hardware resources and provides common utilities and services. It was first created at Bell Labs in 1969 and became widely popular due to its portability, multi-user capabilities, and organized file system. The core of Unix is its kernel which controls processes and resources, while shells are programs that interpret commands from users and work with the kernel to execute them. Common Unix commands allow users to view system information, manage files and directories, and perform other tasks.

Uploaded by

Melvin John
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 19

Unix and Shell

Programming
Subject Code: IS315
What is UNIX?
 The UNIX Operating System (OS) is a large program
(mostly coded in C) that turns the computer into a
useable machine.
 It provides a number of facilities:
 management of hardware resources
 directory and file system
 loading / execution / suspension of programs
 It is simple and easy to use for normal user.
 It is powerful to the experienced user.
 Unix stands for UNiplexed Information and Computing
System
 UNICS→UNIX
(Brief) History
 1969 First UNIX at Bell Labs
 1975 Bell Labs makes UNIX freeware
 1970’s Berkeley UNIX (BSD)
 1980’s TCP/IP
MIT X-Windows
 1990’s The Web,
LINUX
Why UNIX?
 Portable
 Multiuser / Multitasking
 Networking – initially designed to be an
interactive, multiuser, multitasking system,
Networking was added after the split between
BSD Unix and AT & T Unix.
 Organized File System
 Device Independence
 Utilities
 Services
UNIX Environment
 Personal Environment
 Time-Sharing Environment

 Client/Server Environment
Unix Structure
 Unix Consists of four major Components:
 Kernel
 Is the heart of unix system
 Process control & Resource Management
 Shell
 Part of unix visible to user.
 Receives and interprets the command entered by the user.
 Interpreter reads the command & works with the kernel to execute
it
 Three standard shells used in Unix: Bourne, C, Korn
 Standard set of utilities
 Application program
Kernel-Shell Relationship
t e m
s
Sy
n/

er
ti o

s
a

U m

U
l i c

ni m

ll
Co
U

e
x an
Ap

Sh
s

She
er

r
the are
l

O f tw
l

ds
So

Hardware

To ernet
Da cka
Pa
tab ges

ols
Int
as
e

Kernel
Sh
el
l Compilers
e ll
Sh
U
se

e r
r

Us
Accessing Unix
 User ID
 Passwords
 Interactive Session
 Login
 Make contact with the system
 Wait for system login prompt
 Type User id
 Type password

 Interaction
 Logout
Commands
 Basis of all interaction is command, which is
not unique to unix.
 Basic Concepts
 Unix command is an action request given to the
Unix shell for execution
 Source and destination of data

 Command syntax
 $ verb [options] [arguments]
 Verb is the command name
 Option modifies how the action is applied
 Argument provides additional inf. to the command
Common Commands
 Date and time (date) command
date options arguments
-u
$ date
$ date –u
$ date “+Today’s date is : %D. The time is : %T”
 a abbreviated weekday name, Mon.
 A full weekday name, Monday
 D date in the format mm/dd/yy
 M two digit minute
Common Commands
 Calendar (cal) command
cal options [[month] year]
$ cal // current month is printed
$ cal 2010 // calendar for 2010 is displayed
$ cal 8 2010 // calendar for aug. is displayed
Common Commands
 Who’s online (who) command
who options am I
-u: Idle time
-H: Header
$ who // displays currently logged in users
$ who –u // displays active users & idle time of users
$ who –uH // displays active users & idle time of users with
header
$ who am I // displays inf about the user
$ whoami // displays user id
Common Commands
 Change Password (passwd) command
$ passwd
 Print message (echo) Command
$ echo Hello world
$ echo “ Hai, Good Afternoon”
 Online documentation (man) command
man options keywords
-k: search on keyword
$ man cal
$ man man
Common Commands
 Print (lpr) command
lpr options file-list
-P: Printer
$ lpr file1 // prints one file to standard printer
$ lpr file1 file2 file3 // prints 3 file to standard printer
$ lpr –Plp0 file1 file2 file3 // prints 3 file to printer
lp0
Other Useful Commands
 Some less frequently used but some useful
commands
 Terminal (tty) command
 tty utility is used to show the name of the terminal
your using
$ tty
 Clear Screen (clear) command
$ clear
Other Useful Commands
 Set terminal (stty) command
 This command can be used to set or unset selected terminal
i/p / o/p options.
 When the terminal is not responding properly, this
command can be used to reconfigure it.
stty options arguments
-a: display current settings
-g: display current settings (in argument format)
$ stty
$ stty sane // sets the terminal conf. to reasonable settings
Other Useful Commands
 Record Session (script) command
 Used to record an interactive session
script options arguments
-a: append
 Session log is stored in file typescript, which can
be changed by giving the filename as an argument.
$ script
// Type diff. command
$ script unix123
$ script -a
Other Useful Commands
 System Name (uname) command
 This command is used to see the data , such as its
name, about itself
uname options arguments
-a: all, -n: name only, -s: o.s, -r: release
$ uname
$ uname –s
$ uname –sr
$ uname -a
Other Useful Commands
 Calculator (bc) command
 Turns unix into a calculator
 Ctrl+d to terminate.

$ bc
// scale =2, ibase =2, ibase=8, obase=2,

You might also like