SlideShare a Scribd company logo
1 of 39
Introduction To Unix
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.
• 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.
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
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
• Versions of UNIX
• Berkeley UNIX (BSD)
• AT&T UNIX (System V)
Unix Architecture
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.
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.
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
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.
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.
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.
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.
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).
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
General Purpose Utilities
Commands
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.
• cal 12 2000 - Would give you the calendar for
December of 2000.
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
• 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
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
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
• Echo interprets certain strings known as
escape sequence
• Example:
$ echo “enter filename: c”
Enter filename: $_
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
• 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
• 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
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:
$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
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
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]
• 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
• 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
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
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
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
$_
• 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
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
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

More Related Content

Similar to Introduction To Unix.pptx

Similar to Introduction To Unix.pptx (20)

Operating System
Operating SystemOperating System
Operating System
 
Linuxs1
Linuxs1Linuxs1
Linuxs1
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
unixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdfunixoperatingsystem-130327073532-phpapp01.pdf
unixoperatingsystem-130327073532-phpapp01.pdf
 
Spsl unit1
Spsl   unit1Spsl   unit1
Spsl unit1
 
Nithi
NithiNithi
Nithi
 
CHAPTER 1 INTRODUCTION TO UNIX.pptx
CHAPTER 1 INTRODUCTION TO UNIX.pptxCHAPTER 1 INTRODUCTION TO UNIX.pptx
CHAPTER 1 INTRODUCTION TO UNIX.pptx
 
Lecture 4.pptx
Lecture 4.pptxLecture 4.pptx
Lecture 4.pptx
 
Unix/Linux
Unix/Linux Unix/Linux
Unix/Linux
 
Introduction to System Calls
Introduction to System CallsIntroduction to System Calls
Introduction to System Calls
 
Unix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptxUnix Shell Script - 2 Days Session.pptx
Unix Shell Script - 2 Days Session.pptx
 
Linux Basics.pptx
Linux Basics.pptxLinux Basics.pptx
Linux Basics.pptx
 
os_1.pdf
os_1.pdfos_1.pdf
os_1.pdf
 
Presentation1.pdf
Presentation1.pdfPresentation1.pdf
Presentation1.pdf
 
Os concepts
Os conceptsOs concepts
Os concepts
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1Linux Desktop Operation - Session 1
Linux Desktop Operation - Session 1
 
UNIX_Module 1.pdf
UNIX_Module 1.pdfUNIX_Module 1.pdf
UNIX_Module 1.pdf
 
Unix and its Components
Unix and its ComponentsUnix and its Components
Unix and its Components
 
Unix _linux_fundamentals_for_hpc-_b
Unix  _linux_fundamentals_for_hpc-_bUnix  _linux_fundamentals_for_hpc-_b
Unix _linux_fundamentals_for_hpc-_b
 

Recently uploaded

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 

Recently uploaded (20)

call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 

Introduction To Unix.pptx

  • 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
  • 6. • Versions of UNIX • Berkeley UNIX (BSD) • AT&T UNIX (System V)
  • 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