Скачать презентацию Navigating Unix UCR Technical Seminar Series Fall Скачать презентацию Navigating Unix UCR Technical Seminar Series Fall

62ab624605bf90db410472ad00534039.ppt

  • Количество слайдов: 24

Navigating Unix UCR Technical Seminar Series Fall ’ 03 Dan Berger dberger@cs Navigating Unix UCR Technical Seminar Series Fall ’ 03 Dan Berger dberger@cs

Outline Unix History/Philosophy File System Basics Utilities You Shouldn’t Leave ~/ Without Web, Mail, Outline Unix History/Philosophy File System Basics Utilities You Shouldn’t Leave ~/ Without Web, Mail, Office, Windows Printing Looking for Help Asking for Help Learning More Slides online at http: //www. cs. ucr. edu/~dberger

A Brief History of Time^w. Unix Born in the late 60’s at AT&T/Bell Labs A Brief History of Time^w. Unix Born in the late 60’s at AT&T/Bell Labs out of the MULTICS project. Ran on a PDP-11. Thompson, Ritchie, Kernighan, among others. In the 70’s AT&T was prohibited from selling Unix, so they gave it to universities. The contributions from some of those universities (such as Berkeley), and later from MIT, evolved Unix into the

Unix Philosophy Small tools, each of which does one job well. Build pipelines of Unix Philosophy Small tools, each of which does one job well. Build pipelines of these tools to accomplish loftier goals. Users interact with the system through the “shell” – a command-line interface. It’s all about user choice – why have one when you can have three? “Here’s the rope, there’s the tree – help yourself. ”

File System Basics: / There’s no “C: ”, or “Macintosh HD” – the file File System Basics: / There’s no “C: ”, or “Macintosh HD” – the file system is a tree, rooted at “/” Additional volumes can be “mounted” at (fairly) arbitrary spots in the tree. Some key portions of the tree: /bin /etc /lib /proc /dev /home /mnt /tmp /usr /var

. and. . Every directory has two special entries: “. ” and “. . . and. . Every directory has two special entries: “. ” and “. . ” “. ” is the current directory “. . ” is one level up toward the root (/) Confusing them can be unpleasant… Trick Question: what directory does “/. . ” refer to?

Home Directories Unix is inherently multi-user – and in a multi-user system, users can’t Home Directories Unix is inherently multi-user – and in a multi-user system, users can’t scribble their files around at random. Each user on a Unix system has a “home directory” – it’s contents, organization (or lack thereof) are completely up to you. When you log in, you are placed in your home directory (abbreviated ~/).

Manipulating Files from the Shell Task Change Directory Copy Display disk Usage List Files Manipulating Files from the Shell Task Change Directory Copy Display disk Usage List Files Move Make Directory Print Working Directory Remove Directory Command cd target cp src dst du target ls (ls –a, ls –l) mv src dst mkdir target pwd rm target rmdir target

File Permissions Recall: unix is multi-user – the file system keeps track of who’s File Permissions Recall: unix is multi-user – the file system keeps track of who’s allowed to read, write, and execute a given file. The world is divided into three: the user that owns the file, other users in the group that owns the file, and everyone else (other). Changing the mode of the file is done with the chmod command. Permissions are octal bit vectors – one byte for each of the three groups and a

Permissions (Cont. ) Directories have permissions too: read the contents of the directory (not Permissions (Cont. ) Directories have permissions too: read the contents of the directory (not necessarily the contents of the files themselves) write: remove and rename (but not create) files in the directory (not necessarily write to existing files) execute: access the directory (cd into it) Newly created files (and directories) have their default permissions set to (7777 && umask).

Utilities Not to Leave ~/ Without ssh – secure shell – execute commands (or Utilities Not to Leave ~/ Without ssh – secure shell – execute commands (or get an interactive shell) on a remote machine over an encrypted network connection. It’s so cool and versatile, it’s getting it’s own seminar! scp – secure copy – copy files between two hosts over an encrypted network connection. (mostly replaces FTP) rsync – keep directory trees on different machines synchronized.

Browsing the Web Mozilla – it’s cross platform and standard and buzz-word compliant. Galeon Browsing the Web Mozilla – it’s cross platform and standard and buzz-word compliant. Galeon – part of the GNOME desktop – it’s built on (and embeds) mozilla.

Reading Mail Remember “it’s all about choice? ” There are many possible mail readers Reading Mail Remember “it’s all about choice? ” There are many possible mail readers – the department recommends (i. e. the systems group supports): Evolution – something of a MS Outlook “work-alike, ” but without the propensity for worms and other unpleasantness. Other clients include mozilla (gui), mutt (curses). imaps: //imap. cs. ucr. edu smtp: //mail. cs. ucr. edu

Handling Windows Documents Office documents (Word, Excel, Powerpoint) can be opened using Open Office Handling Windows Documents Office documents (Word, Excel, Powerpoint) can be opened using Open Office (ooffice). Try gnumeric on your Excel documents, and abiword on your Word documents.

Printing from Unix Post. Script is the lingua franca of Unix printing. That means Printing from Unix Post. Script is the lingua franca of Unix printing. That means if what you want to print isn’t Post. Script, something has to do the conversion. It also means that if your printer doesn’t understand Post. Script, something has to do that conversion as well. Fortunately, all the department printers understand Post. Script

enscript If you have an ASCII file (e. g. source code) that you want enscript If you have an ASCII file (e. g. source code) that you want printed – enscript is your friend. It will turn ASCII into Post. Script – and even print two pages to a page. Add the following to your. bashrc: export ENSCRIPT=“—landscape – columns=2 –borders –line-numbers –passthrough” enscript –P printername source. cc

Printing Post. Script Files If you already have a Post. Script file, your life Printing Post. Script Files If you already have a Post. Script file, your life is easier: lp –P printername file [file…] Note that PDF’s are not Post. Script – don’t send them to lp unless you want to waste a ream of paper. Also note that printing a postscript file through enscript (or a 2 ps) will likely result in similar waste.

Checking Your Print Job lpq –P printername - shows the print queue for the Checking Your Print Job lpq –P printername - shows the print queue for the given printer. If your job doesn’t appear on the printer – check lpq before you submit it again – make sure it’s not just stuck behind another job. lprm –P printername – removes your job from the specified queue.

Running Windows If you absolutely must run windows – just type “windows. ” It Running Windows If you absolutely must run windows – just type “windows. ” It launches a Windows Terminal Server client. You won’t remember this when you need to – but press Control-Alt-Enter to toggle full screen mode.

Finding Help (man, info, google) man man subject man –k subject info –apropos=subject http: Finding Help (man, info, google) man man subject man –k subject info –apropos=subject http: //www. google. com google: //your+question+here

Asking for Help If you’ve looked in all the places mentioned in the previous Asking for Help If you’ve looked in all the places mentioned in the previous slide, and you still can’t figure it out – there are some simple rules that will improve your chances of getting a good answer from a human: http: //www. catb. org/~esr/faqs/smartquestions. html

Who To Ask? Lab mates, friends, strangers, and finally: systems@cs. ucr. edu Who To Ask? Lab mates, friends, strangers, and finally: systems@cs. ucr. edu

Learning More Teach Yourself Unix in 24 Hours by Dave Taylor Unix Fundamentals course Learning More Teach Yourself Unix in 24 Hours by Dave Taylor Unix Fundamentals course (undergrad, upper division). If you’re interested, drop me an email and I’ll try to get the course offered once we have sufficient interest. Install Linux on your home machine (or notebook) Linux Administration: A Beginners Guide by Steve Shah (a UCR alum).

Shell “Scriptlett’s” shell is also a powerful system scripting language – supporting conditionals, loops, Shell “Scriptlett’s” shell is also a powerful system scripting language – supporting conditionals, loops, variables, etc. for file in *; do echo $file; done x=0 while [ $x –lt 10 ]; do let x=x+1 echo $x done if [ -f somefile ]; then echo “it exists”; else echo “doesn’t exist”; fi