1 / 87

Week-1

Week-1. 1/11/2005. Topics. Unix Introduction Logging In / Logging Out Unix Commands – man, date, cal, who Unix File System Introduction to vi. Operating System. Software program that “runs” (“executes”) on a computer The most important program on the computer

jalene
Télécharger la présentation

Week-1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Week-1 1/11/2005

  2. Topics • Unix Introduction • Logging In / Logging Out • Unix Commands – man, date, cal, who • Unix File System • Introduction to vi

  3. Operating System • Software program that “runs” (“executes”) on a computer • The most important program on the computer • Enables you to store information, process raw data, use application software, access all hardware etc

  4. Operating System Model

  5. PC Operating Systems • A personal computer system or PC is usually a standalone machine, such as a desktop or laptop computer • A PC operating system conducts all the input, output, processing, and storage operations on a single computer

  6. Common PC Operating Systems

  7. Mainframe Operating Systems • A mainframe operating system controls a mainframe system, a large computer system with multiple processors that conducts input, output, processing, and storage operations for many users • Historically, mainframe systems have been popular in large corporations and industrial computing

  8. Common Mainframe Operating Systems

  9. Network Operating Systems • A computer network combines the convenience and familiarity of the personal computer with the processing power of the mainframe • A network lets multiple users share computer resources and files • A network operating system controls the operations of a server computer, sometimes called a host computer, which accepts requests from user programs running on other machines, called clients

  10. Relationship of Servers and Clients on a Network

  11. Unix – a network OS • Multi-user, multi-tasking OS with built-in “networking” functions • Multi-user – More than one user can access/use the computer at the same time. • Multi-tasking – More than one application/program executes on the computer at the same time.

  12. Unix (contd.) • Unix can be used as • Dedicated server in a server-based network • Client computer in a server-based network • Client/Server computer in a peer-to-peer network. • Stand-alone workstation (not connected to any network)

  13. Unix (contd.) • Unix is a portable Operating system – used on a variety of computers (hardware).

  14. Networking Features of Unix • File Transfer Protocols (ftp) • Telnet (remote terminal emulation program) • Mail • Remote access

  15. Unix History • Developed originally at Bell Labs – early 70s • Originally 2 flavors: • AT&T System V • UC Berkeley’s BSD • Currently numerous flavors: • HP-Ux, IBM-Aix, Sun-Solaris, SG-Irix

  16. LINUX • A flavor of Unix that executes on Intel processors • Free • Developed by Linus Torvalds in Finland (1991) • Offers all features of an Unix OS on the PC

  17. Accessing a Unix System • Unix is multi-user: supports multiple users • Every user is identified by an unique username and a password • To access a Unix system, you must have a valid username and password

  18. Usernames • Usually all lowercase • 6-15 characters long • No special characters allowed (spaces, control characters, *, symbols) • Must be unique on the system • Assigned by the System Administrator – cannot be changed by user

  19. Passwords • 6-24 characters long • Initially assigned by System Administrator • Can be changed by user (if allowed) • Not echoed on screen • Can be reset by the System Administrator to a new password

  20. Lab Access • Username: acestudentN • Password: unixuserN

  21. Unix Shell • Unix program that INTERPRETS the COMMANDS entered from the keyboard • Everything you type is a “command” • A “command” is a program that executes on the computer • Shell is a command-interpreter  interprets your commands for the Operating system

  22. Types of Shells • Bourne Shell – developed by Steve Bourne at AT&T (sh) • Korn Shell (ksh) more user-friendly than sh • C Shell (csh) same syntax as C programming language • Bash Shell – available with Linux • tcsh, zsh

  23. Choosing a Shell • The user’s shell is assigned by the System Administrator during the creation of the user’s account. • Can be changed by the user – by just typing the name of the new shell e.g. to change to Korn shell, type ksh • Type exit to revert to previous shell

  24. Terminology • Operating System • Shell • Command-line • Prompt

  25. Entering Commands • Everything typed on the command-line is treated as a Unix command. • The command is NOT interpreted until you press the “Return” or “Enter” key • Unix is case-sensitive. • All Unix commands are lower-case • Unix comes with a set of pre-defined commands

  26. date • Displays the system date and time • At the prompt, type date and press enter • Sequence • The shell interprets the command • the OS executes the program for that command • the output is displayed on the screen • the shell waits for the next command

  27. cal • Displays the calendar for the current month • At the prompt, type cal and press enter

  28. who • Displays the list of users currently logged into the system • At the prompt, type who and press enter

  29. Multiple Commands • More than one command can be typed on the same command-line – the commands must be separated by a semi-colon (;) • Commands are executed in sequence: Left to Right • $ who;cal<Enter> • $ cal;date<Enter> • $who;cal;date<Enter>

  30. Unix Commands and Options • Every command has a specific syntax. • cal is different from Cal, caL, CAL … etc • A command can be followed by “an option” to change the behavior of the command • Options are prefixed with a hyphen (-)

  31. cal - revisited • $ cal -y

  32. Command arguments • Some commands also accept “arguments” to be able to operate successfully • E.g. A command that displays a file needs the name of the file as an argument. • A command that deletes a file needs the name of the file as an argument

  33. cal - revisited • The cal command can also display the calendar for a specified month and year • The cal command can take 2 numbers as arguments • 1st argument: Month (any number from 1 to 12) • 2nd argument: Year (any number from 1 to 9999)

  34. cal (contd.) $ cal 10 2000<Enter> Displays the calendar for Oct 2000 $ cal 11 1999<Enter> Displays the calendar for November 1999

  35. man • The man command displays information about other Unix commands. • Displays the manual pages of the command • Takes the command name as the argument • e.g. $ man cal<Enter> Displays information about the cal command • Similar to on-line Help in windows • Type :q to exit

  36. Output of the man command • Name: - the name of the command and a short statement describing its purpose • Synopsis- a syntax diagram showing the usage of the command • Description – a more detailed description than the name item above • Options – a list of options and their purposes • See Also: other commands or man pages that provide related information • Bugs: a list of the command’s known bugs

  37. man - examples $ man date $ man man

  38. whatis • The whatis command displays brief information about other commands • e.g. $ whatis cal $ whatis date

  39. passwd • The passwd command is used to change the user’s password • Syntax: passwd • Will prompt for new password twice • New password is not echoed on the screen • New password must differ from old password by at-least 3 characters

  40. Logging out of Unix Shell • Korn/Bourne/Bash shells: type exit or Ctrl-D • C Shell type logout

  41. Output Redirection • The output of any Unix command can be “redirected” using the redirection operators > and >> • > is used to redirect the output in the “over-write” mode • >> is used to redirect the output in the “append” mode

  42. Redirection • Output of a command can be redirected to a file using the > operator • Original contents of the file are lost. • e.g. $ who > list_of _users

  43. Redirection (contd.) • Output of a command can be appended to a file using the >> operator – original contents of the file are retained. • e.g. $ who > list_of_users $ date >> list_of_users

  44. Output Redirection (contd.) • e.g. $ man cal > cal_manual.txt • $ man date > date_manual.txt • $ cal 1999 > calendar_1999.txt • $ cal 2020 > calendar_2020.txt • $ cal 2000 > calendar_2000_2002.txt • $ cal 2001 >> calendar_2000_2002.txt • $ cal 2002 >> calendar_2000_2002.txt

  45. Viewing a file • cat – concatenate and display file • Syntax: cat filename … • Displays contents of file(s) • e.g. $ cat list_of_users

  46. Lab Exercise • Create a file called cal_man.txt containing the man pages for the cal command • Add the current date and time to the file cal_man.txt man cal > cal_man.txt date >> cal_man.txt

  47. Lab Exercise • Create a file called date_cal.txt containing the outputs the date and cal commands date > date_cal.txt cal >> date_cal.txt date cal > date_cal.txt date; cal > date_cal.txt date > date_cal.txt ;cal >> date_cal.txt

  48. more • more – display file one screen at a time • Syntax: more filename … • Press space-bar for next screen • Ctrl-c or q to quit • e.g. $ more cal_manual.txt • Can display multiple files

  49. Creating files using cat • cat command can be combined with the redirection operators to create a text file • e.g. $ cat > memo This is a memo Ctrl-D $ • Ctrl-D terminates the cat session

  50. cat (contd.) • The cat command can also be combined with the >> operator to append to an existing text file • e.g. $ cat >> memo This is line 2 of the memo Ctrl-D $

More Related