1 / 116

UNIX 101: UNIX For Windows Users

UNIX 101: UNIX For Windows Users. Lecture 1 9 September 2005 Sponsored by ACM. 1. The Cold Hard Truth. This course is NOT officially sponsored by the CS department You will NOT receive credit for this course - neither will we for that matter

kimball
Télécharger la présentation

UNIX 101: UNIX For Windows Users

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. UNIX 101:UNIX For Windows Users • Lecture 1 • 9 September 2005 • Sponsored by ACM 1

  2. The Cold Hard Truth • This course is NOT officially sponsored by the CS department • You will NOT receive credit for this course - neither will we for that matter • If we say something that offends you, deal with it. • You should try NOT to snore when you fall asleep • We did this course on our own time, so try to make the best of it for all of us. 2

  3. Just Who Do We Think We Are? • Mark Kegel - Tall Guy with Black Hair • mkegel@cs.hmc.edu • Marshall Pierce - Broad Shouldered Guy • mpierce@cs.hmc.edu 3

  4. And Just What Do We Think We’re Doing? • We are here to teach you (what we think are) the fundamentals of Unix. • We are here to teach you to teach yourself about Unix. • We’re on a mission from God. 4

  5. Never Mind Us, Who Are You People? • Students who have no experience with Unix • Students who have some experience but want a better grounding in Unix • Someone who is lost, confused, and looking for spiritual enlightenment 5

  6. Some Reasons to Learn About Unix • Growth of Linux • OS X is based on Unix • Expanded skill set - useful knowledge • You want to be a l33t h4X0r • BTW, you will always be teh newb 6

  7. Some Better Reasons to Learn About Unix • I want to show my girl\boy-friend some cool Unix tricks • FYI: Real CS Majors never see the light of day much less significant others • I am a CS major... • ...or I plan on taking a class (CS60 or above) from the CS department 7

  8. The Best Reasons To Learn About Unix... • As a CS major at Mudd you need to have a working knowledge of Unix • The CS department refuses to offer a Unix course (they do have good reasons though!) • But why are you really here? 8

  9. To Make This Perfectly Clear... • We will NOT teach you how to use application XXXX or show you neat tricks for application XXXX • This course is not the equivalent of a course in Word or Excel • We will also NOT teach you to how to program in Unix 9

  10. Down To Business... • Computing Resources Available To You • Terminal Room: Beckman B102 • Mac minis (aren’t they just so cute) • Printer: gute.cs.hmc.edu • Graphics Lab: Beckman B105 • some old’n’busted computers 10

  11. AC and LAC Labs • Windows and Mac Computers • Printers: Odie and Cujo, Clifford and Astro • Scanners in alternate AC lab • Engineering Lab • Houses engineers, avoid at all costs (they snarl and bite; Holy Water and Crosses are said to keep them away) 11

  12. All-Campus Servers • odin.ac.hmc.edu • RHEL server; Student POP server • thuban.ac.hmc.edu • VMS server; hosts DNS • banshee.st.hmc.edu • Huge Cisco box; campus wide router 12

  13. CS Dept. Servers • turing.cs.hmc.edu (sparc) • primary work server - you’ll do most of your work from here • knuth.cs.hmc.edu (x86) • our new server - where you ought to be working when you can • wilkes.cs.hmc.edu (x86) • alternate work server • muddcs, ark, cortana, durandal 13

  14. The Doctor Will See You Now • Mudd employs several whose jobs entail fixing computer and network problems • Tim Buchheim - Computer Science Dept. • Maintains the CS Department computers • Roger Wiechman - CIS • Maintains the Mudd Network 14

  15. When Hippies walked the earth... • Computers were real dinosaurs • Barely had timesharing systems • No video terminals - teletypes instead • RAM and CPU power limited • there’s only so many beads you can fit on an abacus 15

  16. When Hippies walked the earth... • Ken Thomson • Invented UNICS in 1969 • UNIplexed Information and Computing Service • That year also ARPANET, and man most likely landed on the moon • Why? He needed a way to play a game... • After that Unix's history is kind of a blur 16

  17. Unix Today • Fundamentally multi-user and multi-tasking • Programmer’s and tinkerer’s environment • Support and encouragement for hacking the system; FOSS is your friend • Powerful tool in the right hands • Runs the world’s most powerful computers • Is a thirty year old OS that Microsoft still hasn’t been able to copy correctly 17

  18. The Idea of Unix? • Unix is more than an OS, it is • a programming language - C • a broad philosophy of how computers and users should interact • an interface - POSIX • more than the sum of its parts • the code that Ken Thomson wrote? 18

  19. A discourse on the dialectic sublimation inherent in the praxis of methodological analysis of UNIX philosophy. • Programs should be designed to work together • Accept input that isn’t strictly formatted • Produce output that is nicely formatted • Should work exclusively with text streams • Programs should be simple and small • Do one task, and do that task well 19

  20. More Unix Philosophy... • KISS - Keep It Simple Stupid • Keep things as simple as possible • Separate Mechanism From Policy • Users should be able to decide how a program is to look and behave • Internals (Mechanism) should not be locked into one policy 20

  21. More Unix Philosophy... • Principle of Least Surprise • When programs have nothing important to tell you, they will tell you nothing • Programs should die early and noisily when they die • There is no “One True Way”™ • Unix is not perfect! But it’s still better than Windows • Many more philosophical rules than this! 21

  22. http://pangea.stanford.edu/computerinfo/unix/overview/advantages.htmlhttp://pangea.stanford.edu/computerinfo/unix/overview/advantages.html - The traditional command line shell interface is user hostile -- designed for the programmer, not the casual user. - Commands often have cryptic names and give very little response to tell the user what they are doing. Much use of special keyboard characters - little typos have unexpected results. - To use Unix well, you need to understand some of the main design features. Its power comes from knowing how to make commands and programs interact with each other, not just from treating each as a fixed black box. - Richness of utilities (over 400 standard ones) often overwhelms novices. Documentation is short on examples and tutorials to help you figure out how to use the many tools provided to accomplish various kinds of tasks. 22

  23. Pleasure You Want. Protection You Trust. • Everything in Unix is owned by someone • Files, programs, devices, etc. • Unix protects users, their data, and their programs from one another • Regular users are not allowed to do dangerous things to the system • Distinction between being a “user” and being an “admin” 23

  24. Three types of lusers...err users • Administrative users (aka root) • Complete control over everything on the system - allowed special privileges • Can become any user on the system • Exists on nearly every Unix-based system • Used for System Maintenance and Administration 24

  25. Returning to Normal • Normal Users (aka you, me, and crazy ivan) • Allowed to use most of the programs on the system • Have a special area all to yourself • Home directory - belongs to you! • Stores user specific programs, data, and configuration information • Limited in size on knuth and odin 25

  26. There’s just nobody@home.com • System users • generally used to run daemons • Why would running a daemon as a regular user or as root be a problem? • do not usually have home directories • you cannot log in as one of these users • examples: bin, lp, mail, pop, sshd, nobody 26

  27. Unix Rockstars and their Groupies • Group: a set of users • Every user belongs to at least one group: their primary group • Groups allow for easier management of a system • students group on turing • operator group for consultants 27

  28. Unix Pre-School:Logging In • If you don’t have an account on knuth, go see Tim! • Every user has a username and a password • Passwords are secret; usernames are not • Do your best to keep passwords secret!! • You should try to have as strong a password as you can remember 28

  29. g00D P@$$w0rds • Should be at least 8 characters long • Should include special characters • Digits, - @ ! # $ % ^ & . , ( ), spaces • Use a mix upper and lower case letters • Never use a plain dictionary password! • elephant is not a good password • Pass-phrases are better • I took CS60 ⇒ 1 t00k CS-6o# 29

  30. Sessions of the Heart • Unix is at its heart a command line OS • Invented in the days of the teletype • Physically separated input and processing • location of the teletype unimportant • Today we use emulated terminals • Unix offers graphical environments, but that isn’t where the real power lies 30

  31. The Blinking Cursor of DoomWhy learn to use the command line? • You have to whether you like it or not • Simple, Quick, and Powerful • Efficient • Superior for certain tasks • New way for you to think about how to interact with a computer • Necessary skill to be a Power User • Gives +4 to your Geek skill; -4 to Social Interaction and Aroma 31

  32. Home Sweet Home • When you log in you’ll find yourself in your home directory • Located at (on most *nixes) • /home/username, 1328 Mulberry Drive • Stores all you personal configuration information • Is where you’ll keep all your data: homework, documents, etc • Is your personal space; can do whatever you’d like 32

  33. Unix Directory Tree • Unix directories are separated with the / (slash) character • The Unix directory tree starts at / (root) • Devices can be located most anywhere on the tree (no Windows A:, C:, D:, stuff) • The directory tree is filesystem independent • Do you know which computer your home directory is on? 33

  34. Introducing The Shell • The shell is an interactive program that sits between you and the OS • Is executed as soon as you log in • Translates your commands into actions that the computer can perform • shell == “command interpreter” • The shell is your new best friend; you’ll have lots of fun together. 34

  35. Syntax of a Command • Any line with a % preceding it is probably happening on the command line • Jobbies in brackets [~~~] are optional • Jobbies in angle brackets <~~~> are required • Command syntax • % command [switches] [arg1] [arg2] ... • (output here) 35

  36. Switches • Switches (aka flags) are special arguments passed in to a program to alter its behavior • Follow two general styles - Unix and GNU • Unix: dash ‘-’ followed by a single character • GNU: Double dash ‘--’ followed by a word • Programs can take many, many switches • Newer programs may also have Unix and GNU style switch for the same action 36

  37. Arguments • Like switches, variable in number • Provide some form of data that the program can operate on • Can be filenames, email address, another command, keywords to search for, patterns, text, random gibberish (or is it?) • You should get conformable with both switches and arguments • BE CAREFUL WHAT YOU TYPE !! 37

  38. Basic Commands 38

  39. Basic Commands 39

  40. Basic Commands 40

  41. Some things to know • Unix is case sensitive - ‘pwd’ != ‘pWd’ • Unix commands are short • cp = copy; mv = move; rm = remove • Unix commands are almost always lower-case • Switches come on both upper and lower-case • Often have different meanings! Watch Out! • Pay attention to special characters 41

  42. Ctrl+World = Mwahahaa!!! • Shortcut sequences are often denoted as C-?, M-?, and ^?, where ? is some key • C = Ctrl = ^ • M = Meta ~ Alt ~ Option (on Mac only) • You’ll see this often in documentation, particularly in emacs docs 42

  43. Let me outta here! • Exiting or stopping (by which I mean using) some programs (by which I mean vi) can be a challenge • Some standard exit shortcuts • C-d : sends EOF to program • C-c : interrupts the program • C-\ : exits program causing a core dump • Programs do not have to obey these shortcuts, and may map them to another function. 43

  44. Manna from Heaven:Tab Completion • Wouldn’t it be nice if you didn’t have to type /home/OneReallyLongName every time? • You can use the tab key to complete commands and arguments to commands • Can complete: • commands, switches, host names, directory names, process names, man pages, and more 44

  45. Line Editing • The up arrow key will cycle back through your command history; pressing down arrow will cycle forward • The left and right arrow keys will move the position of the cursor so you can insert new characters • Backspace and delete work as expected 45

  46. Line Editing • C-? will delete back • C-d will delete forward • C-u will delete the entire line • C-k will delete the forward from the cursor • C-l clears the terminal • C-y will paste the characters you have deleted 46

  47. Line Editing • C-a will move to the beginning of the line • C-e will move to end of the line • M-b will move back a word • M-f will move forward a word • C-_ will undo the last thing typed • C-r will allow you to search your command history 47

  48. Are You “Special”? • The shell interprets a number of characters as having special meaning • Which characters are special? • # $ * ? [ ] ( ) = | ^ ; < > ` $ “ ‘ \ • Special characters have many uses that we will cover through the course 48

  49. Escape From \”Reality\” • To pass special characters into programs you need to escape them, precede with a \ • \ disables the special meaning of the character • Can also disable meaning through quoting • ‘xxx’ - all characters disabled • “xxx” - all but $, ‘, and \ disabled • \ can also be used to continue a command across multiple lines 49

  50. Finding Help:The Larry Page Center for Unix Addicts • You can’t teach yourself everything. Admit it, you’re going to need help. • Resources: • Google - always try Google first • Websites - freebsd.org, linuxquestions.org • Books - Unix Power Tools, FreeBSD Handbook • People - Staff and Consultants • QREFs - Documentation provided by CS Dept. • Mailing Lists and Forums - linux-l@cs.hmc.edu 50

More Related