2. Unix OS
• An operating system (OS) is a program that
allows you to interact with the computer -- all
of the software and hardware on your
computer. How?
• Basically, there are two ways.
3. • With a command-line operating system (e.g.,
DOS), you type a text command and the
computer responds according to that
command.
• With a graphical user interface (GUI) operating
system (e.g., Windows), you interact with the
computer through a graphical interface with
pictures and buttons by using the mouse and
keyboard.
4. UNIX OS WINDOWS OS
Supports multithreading Does not support
multithreading
Unix is text based Windows is GUI based
Unix is not event driven Windows is event driven
unix supports multiuser windows does not support
the multiuser session
unix is open source
operating system
windows not like that
More secure Less secure
Command oriented Desktop oriented
Difficult understand Easy to understand
5. What is Unix
• The UNIX operating system is a set of
programs that act as a link between the
computer and the user.
• History of UNIX
• Developed in 1969 at AT&T Bell Laboratories
• Became widely available in 1975
• Designed to run on a wide range of systems
8. Kernel
• The UNIX kernel is the heart of the Operating
system.
• The kernel directly controls the hardware.
• It controls functions like File Management and
Security, Input/Output services, Memory
Management, Process Scheduling and
Management, System accounting. Interrupt
and error handling, and also Date and time
services.
9. Shell
• It acts as a command interpreter for the
commands input by the user.
• The shell takes the user commands as input,
processes them into suitable system calls to
interact with the kernel which in turn interacts
with the hardware to perform the task.
• The shell does not interact directly with the
hardware.
10. Features OF Unix
• Multiuser System:
More than one user can use the machine at a
time supported via terminals (serial or
network connection)
• Multitasking:
Multi-tasking operating systems permit the use
of more than one program to run at once
11. Features OF Unix
• Multi-threading :-
– In UNIX a task is divided into multiple sub-
tasks called as threads.
– Each sub-task is given to a CPU, hence all these
sub-tasks are executed simultaneously.
– At the end of execution of these sub-tasks,
they are linked together to give the final
output.
12. Multiprograming
• Running more then one program with in an application
to perform a certain task.
• Example : In MS WORD, Writing in document and
sending Email
Multitasking
• Running more then one application to perform a
certain task.
• Example: listening Song, playing game, work in ms
word, excel and other applications simultaneously
Multiprocessing
• Running more then one instruction through a
processor.
• Example When create a file then computer takes Time
and date default.
13. Features OF Unix
• Portability:-
The ability of software that operates on one
machine to operate as efficiently on another
different machine, without making major
changes to the software is termed as
portability.
14. Features OF Unix
• System Security:-
– UNIX being a multi-user operating system
offers protection of one user's information
from another.
– It maintains a list of users who are allowed to
access the system.
– It also keeps track of what files and resources
each user is authorized to use.
15. Features OF Unix
• I/O Redirection & Piping:-
– UNIX commands are designed in such a way
that they take input from a conceptual file
called the Standard Input (usually the
keyboard) and send their output to another
conceptual file called the Standard Output
(usually the VDU or the monitor).
16. Features OF Unix
• Programming Facility:-
– The UNIX shell has all the necessary things like
control structures, loops and variables which
establish it as a programming language
18. Cal:The Calendar
• Purpose
cal - displays a calendar
Cal displays a simple calendar. If arguments are not
specified, the current month is displayed
• Syntax
cal [month] [year]
• Month:
• Specifies the month for you want the calendar to be
displayed. Must be the numeric representation of the
month. For example: January is 1 and December is 12.
• Year:
• Specifies the year that you want to be displayed.
19. • cal 12 2000 - Would give you the calendar for
December of 2000.
20. Date: Displaying the System Date
• Purpose:
date - print or set the system date and time
• You can display the current date with the date
command which shows the date and time to the
nearest second
• $ date
Wed AUG 31 16:22:40 IST 2005
• The command can also be used with suitable
format specifiers as arguments each format is
preceded by + symbol followed by the %
operator and a single character describing the
format
21. • Example:
U can print only the month using the format +%m:
$ date +%m
08
Or the month name
$date +%h
Aug
Or you can combine them in one command:
$date +”%h %m”
Aug 08
22. There are many other format specifiers
• d -day of the month(1 to 31)
• y-last two digits of the year
• H,M and S-the hour minute and second
respectively
• D-the date in the format mm/dd/yy
• T-the time in the format hh:mm:ss
23. Echo:Displaying A Message
• This command is often used to display a
diagnostic message on the terminal or to issue
prompts for taking user input
• For eg:
To display a message
echo Sun Solaris
To evaluate shell variables
echo $SHELL
24. • Echo interprets certain strings known as
escape sequence
• Example:
$ echo “enter filename: c”
Enter filename: $_
25. Printf:An alternative to echo
• This command in its simplest form is used as an
alternative to echo:
• $ printf “No filename enteredn”
No filename entered
$_
printf also accepts all escape sequences used by
echo but unlike echo it doesn’t automatically
inserts a newline unless n is used explicitly
26. • Printf commonly use many of the formats shown
below
• %s -String
• %30s -as above but printed in a space 30
characters wide
• %d -decimal integer
• %6d - as above but printed in a space 6
characters wide
• %0 -octal integer
• %x -hexadecimal integer
• %f -floating point number
27. • It can convert data from one form to another
• $ printf “ the value of 255 is %o in octal and
%x in hexadecimaln” 255 255
• The value of 255 is 377 in octal and ff in
hexadecimal
28. Who: Who Are The Users
Purpose:
Identifies the users currently logged in.
The who command displays information about
all users currently on the local system. The
following information is displayed:
29. $who
Root console Aug 1 07:51 (:0)
Kumar pts/10 Aug 1 07:56 (pc123.heavens.com)
Sharma pts/6 Aug 1 02:10 (pc125.heavens.com)
• The first column shows the usernames(or user-ids)of
3 users currently working on the system
• The second column shows the device names of their
respective terminal
• The third fourth and fifth column show the date and
time of logging in
• The last column shows the machine name from
where the user logged in
30. tty: Knowing your Terminal
• Tty terminal tells you the filename of the terminal
you are using
• Tty(teletype) command is simple and needs no
arguments
• $ tty
/dev/pts/10
• The terminal filename is 10( a file named 10)
resident in pts directory
• This directory in turn is under /dev directory
31. bc :the calculator
• When you invoke bc without arguments,the
cursor keeps on blinking and nothing seems to
happen
• bc belongs to a family of commands called
filters
$ bc
7 * 9
63
[cntrl-d]
32. • U can make multiple calculations in the same line using ; as
delimiter
12*12 ; 2^32
144
4294967296
• Bc also performs integer computation and truncates the
decimal portion
9/5
1 decimal portion truncated
• On command line you can do it :
$bc
scale = 2
17/7
2.42
33. • Bc is also useful in converting numbers from one base
to another
• You can convert binary numbers to decimal
set ibase(input base) to 2
ibase=2
11001010
202
• The reverse is also possible
obase=2
14
1110
34. Passwd:changing your password
• Allows you to change your password.
• passwd - entering just passwd would allow you to
change the password. After entering passwd you will
receive the following prompts:
• $passwd
passwd:changing password for kumar
Enter login password:******
New password:*********
Re-enter new password:*********
Passwd(system):passwd successfully changed for kumar
35. Uname:knowing your machine
characteristics
• The uname command displays certain features of
the operating system running on your machine
• $ uname
Linux
• The current release(-r):Unix command uses –r
option to find out the version of your operating
system
• $uname –r
5.8
36. Script: Recording your session
• Lets you record your login session in a file
• If you are doing some important work and wish to keep a
record of all your activities you should invoke this command
immediately after you log in
• $script
Script started file is typescript
$_
• Whatever you enter here gets recorded in a file typescript
• After your recording is over,you can terminate the session by
entering exit
• $exit
Script done,file is typescript
$_
37. • U can now view this file with the cat
command
• If you want to append to it,or want to use a
different log file,
• Script –a typescript appends to existing file
typescript
Script logfile logs activities to file logfile
38. Wrap up
• Cal produces the calendar of the month or year
• Date can display any component of the system
date and time in a number of formats
• Bc is the calculator. you can use any numbering
system or degree of precision you want
• Script is the unix system recorder which logs all
the activities of the user in a separate file
• Passwd is used to change a users password but is
not displayed on the screen
39. Wrap up
• Who shows the users working on the system
and the time of logging in
• Uname reveals details of your machines
operating system(-r)
• Tty displays the device name of your terminal