32
Introduction to UNIX

Introduction to UNIX. 2 History of Unix 1960 Software based on Hardware Limits 1969 Ken Thompson Develop a Better Programming Environment 1971 New

Embed Size (px)

Citation preview

Page 1: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

Introduction to UNIX

Page 2: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

2

History of Unix

1960 Software based on Hardware Limits

1969 Ken Thompson Develop a Better Programming

Environment1971

New Operating System - Unix Dennis Richie

Page 3: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

3

History of Unix

Digital’s Role in Expanding Unix Introduced new PDP Computers 80% of all Colleges used DEC PDPs Included Unix

Unix Continues to Evolve Colleges & Universities AT&T Bell Labs

Page 4: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

4

History of Unix

Problem Need to Port Unix to Other Platforms Unix written in Assembly Language

Solution Rewrite Unix Using `B` `B` Limitations `B` Required Modifications to Write Unix

Page 5: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

5

History of Unix

`B` Programming Language Extensive Changes Made For Unix

Renamed to `C` High & Low Level Programming

Language Increased Portability Easier to Improve & Enhance Unix

Page 6: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

6

History of Unix

1983 AT&T Announces Unix System V 1st Commercial version of Unix Unix Improvements Continue…

Unix System V Interface Definition (USVID) Clearly Defines Unix Interface Opens Unix Development

Page 7: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

7

Using Unix

Graphical Interface Xwindows

Command Line Command Prompt

Page 8: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

8

Unix Philosophy

Simple and Easy to UseMake Each Program Do One Thing

WellExpect the Output of One Program To

Be The Input Into AnotherBuild New Programs to do the JobSmall is Beautiful

Page 9: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

9

Accessing Unix

Connect to UnixLoginPasswordPerform Necessary WorkLogout

Page 10: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

10

Important Usage Notes

Return KeyESC (Escape Key)Ctrl (Control Key)Unix Is Case Sensitive

Upper Case and Lower Case Are Different!

Use Lower Case

Page 11: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

11

Unix Login

`$` Unix Command PromptReady For Next Command

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:$

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:$

Page 12: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

12

Unix Login

Login incorrect Incorrect Login name? Incorrect Password?

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:Login incorrectlogin: rdefePassword:$

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:Login incorrectlogin: rdefePassword:$

Page 13: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

13

Unix Login

`$` = Command Prompt = Unix Shell Bourne Shell C Shell Korn Shell Bash Shell

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:$

Red Hat Linux release 4.2 (Biltmore)Kernel 2.0.30 on an i586login: rdefePassword:$

Page 14: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

14

Changing Your Password

Select a ‘Good` Password 7 Characters , Include Non-Alphas

$ passwdPassword:New password:New password (again):Password changedpasswd: all authentication tokens updated successfully$ exitLogin:

$ passwdPassword:New password:New password (again):Password changedpasswd: all authentication tokens updated successfully$ exitLogin:

Cntrl-D can also be used to logout

Page 15: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

15

Changing Your Password

When The Command Doesn’t Work Too Short or Too Simple

$ passwdPassword:New password:it's WAY too shortNew password:Password change abortedpasswd: Authentication token manipulation error$

$ passwdPassword:New password:it's WAY too shortNew password:Password change abortedpasswd: Authentication token manipulation error$

Page 16: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

16

Correcting Typing Errors

Backspace Key Cntrl-h is also backspace

Cntrl-c Ignore current line, return to $ Stop Currently Running Command

Page 17: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

17

Unix Commands

Making a Mistake The Command Interpreter `bash`

Responds `Command not found`

$ xbash: x: command not found$

$ xbash: x: command not found$

Page 18: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

18

Unix Commands

date Current System Date & Time Note: No Arguments & No Options

Argument Extra Information Passed along to the

commandOption

Causes the command to do something different

$ dateMon May 25 12:44:04 EDT 1998 $

$ dateMon May 25 12:44:04 EDT 1998 $

Page 19: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

19

Unix Commands

cal Displays Current Month

$ cal January 1996 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 31$

$ cal January 1996 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 1314 15 16 17 18 19 2021 22 23 24 25 26 2728 29 30 31$

Page 20: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

20

Unix Commands

cal [month] [year] Use Arguments to Display a specific

Month & Year

$ cal 10 1996 October 1996 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31$

$ cal 10 1996 October 1996 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31$

Arguments

Page 21: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

21

Unix Commands

cal [year] Display An Entire Year Use Cntrl-S/Cntrl-Q to Pause/Unpause Screen

$ cal 1996 1996

Jan Feb Mar S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 3 4 5 6 1 2 3 1 2 7 8 9 10 11 12 13 4 5 6 7 8 9 10 3 4 5 6 7 8 914 15 16 17 18 19 20 11 12 13 14 15 16 17 10 11 12 13 14 15 1621 22 23 24 25 26 27 18 19 20 21 22 23 24 17 18 19 20 21 22 2328 29 30 31 25 26 27 28 29 24 25 26 27 28 29 30 31…more...

$ cal 1996 1996

Jan Feb Mar S M Tu W Th F S S M Tu W Th F S S M Tu W Th F S 1 2 3 4 5 6 1 2 3 1 2 7 8 9 10 11 12 13 4 5 6 7 8 9 10 3 4 5 6 7 8 914 15 16 17 18 19 20 11 12 13 14 15 16 17 10 11 12 13 14 15 1621 22 23 24 25 26 27 18 19 20 21 22 23 24 17 18 19 20 21 22 2328 29 30 31 25 26 27 28 29 24 25 26 27 28 29 30 31…more...

Page 22: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

22

Unix Commands

who Display Current Users Note: No Options & No Arguments

$ whordefe pts/2 Aug 23 20:25jsmith pts/5 Aug 23 22:30rdefe pts/1 Aug 23 13:53$

$ whordefe pts/2 Aug 23 20:25jsmith pts/5 Aug 23 22:30rdefe pts/1 Aug 23 13:53$

Page 23: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

23

Unix Commands

who -q option

Display a Quick List of Current Users

$ who -qrdefe jsmit sbrowusers=3$

$ who -qrdefe jsmit sbrowusers=3$

Option

Page 24: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

24

Unix Commands

mail [login id] Sending Unix Mail

$ mail johndSubject: Test emailHello thereThis is a test of my first unix email

$

$ mail johndSubject: Test emailHello thereThis is a test of my first unix email

$

Add additional logins here

To send, hit Cntrl-D on a Blank Line

Can only correct the line your currently on

Page 25: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

25

Unix Commands

mail Reading Unix Mail

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re:passwd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re:passwd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

Mail Prompt - Enter Mail Commands

Page 26: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

26

Unix Commands

Reading Mail + (Enter Key) - Display Next Message - Display Previous Message 3 To Display Message 3

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re:passwd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re:passwd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

Page 27: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

27

Unix Commands

mail commands h - Display Mail Header Information s [message list] filename - Save message to a

file d [message list] - Delete message u [message list] - Undelete message R - Reply to Author r - Reply to All mail [login] - Send email

Page 28: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

28

Unix Commands

mail commands x - Exit without saving changes

No messages deleted q - Exit save changes

Deleted messages are deletedRead email moved to a file named mbox

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re: asswd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

$ mailMail version 5.5-kw 5/30/95. Type ? for help."/var/spool/mail/rdefe": 1 message 1 unread>N 1 [email protected] Sat Aug 23 22:54 12/402 job info U 2 [email protected] Tue Apr 12 19:51 60/1000 Re: asswd 3 [email protected] Sat Mar 12 14:59 15/348 mail 4 [email protected] Wed Feb 16 16:41 9/261 trouble&

Page 29: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

29

Unix Commands

Using mail to read saved mail files

$ mail -f lettersMail version 5.5-kw 5/30/95. Type ? for help."letters": 1 message 1 unread> 1 [email protected] Sat Aug 23 22:54 12/402 job 2 [email protected] Tue Apr 12 19:51 60/1000 lunch &

$ mail -f lettersMail version 5.5-kw 5/30/95. Type ? for help."letters": 1 message 1 unread> 1 [email protected] Sat Aug 23 22:54 12/402 job 2 [email protected] Tue Apr 12 19:51 60/1000 lunch &

-f followed by the file name

$ mail -f$ mail -f Reads the file mbox when the file argument is left out

Page 30: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

30

Unix Commands

write [login] Send a message to the screen someone’s

screen$ write jsmithThis is a test of the write command

$

$ write jsmithThis is a test of the write command

$

Press Cntrl-D to return to a $ prompt

$Message from [email protected] on ttyp0 at 22:59 ...This is a test of the write command<EOT>

$Message from [email protected] on ttyp0 at 22:59 ...This is a test of the write command<EOT>

jsmith’s terminal

Page 31: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

31

Unix Commands

mesg Turn online messages on/off

$ mesgis y$ mesg n$ mesgis n

$ mesgis y$ mesg n$ mesgis n

Display current message status

Turn messages off

Page 32: Introduction to UNIX. 2 History of Unix  1960 Software based on Hardware Limits  1969 Ken Thompson Develop a Better Programming Environment  1971 New

32

Unix Commandsman [unix command]

On-line Reference Manual Spacebar - Display Next Page b - Previous

Page q - Quit http://www.ntua.gr/cgi-bin/man-cgi$ man who

WHO(1)

NAME who - show who is logged on

SYNOPSIS who [-imqsuwHT] [--count] [--idle] [--heading] [--help] [--message] [--mesg] [--version] [--writable] [file] [ami]

DESCRIPTION This documentation is no longer being maintained and may be inaccurate or incomplete. The Texinfo documentation is :

$ man whoWHO(1)

NAME who - show who is logged on

SYNOPSIS who [-imqsuwHT] [--count] [--idle] [--heading] [--help] [--message] [--mesg] [--version] [--writable] [file] [ami]

DESCRIPTION This documentation is no longer being maintained and may be inaccurate or incomplete. The Texinfo documentation is :