![Page 1: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/1.jpg)
THE UNIX SYSTEM
Ashish GuptaTA , Intro to Networking
Jan 14 2004Recital 2
Introduction to Networking , Instructor: Prof. Yan Chen
![Page 2: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/2.jpg)
![Page 3: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/3.jpg)
![Page 4: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/4.jpg)
![Page 5: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/5.jpg)
![Page 6: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/6.jpg)
Unix Tools
• Shells
• Useful Commands
• Pipes & Redirects
![Page 7: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/7.jpg)
Shells
• sh, csh, ksh, tcsh, bash, zsh
• Recommend tcsh or bash for interactive use. Both have command completion, simple command line editing and simple to use history facilities.
• Change logon shell using chsh
![Page 8: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/8.jpg)
Intro to Unix: Files
• Filesystem a single tree ( no drives )
• Filenames case senstitive
• Physical devices can be mounted anywhere
/
tmp dev etc home usr
chris libmary include bin local
lib include bin
![Page 9: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/9.jpg)
Some basic commands
• the bash shell has automatic completion, just press <TAB>
• completion is used for command names and for file names
– try:
• pressing <tab> twice gives you all options
– try:
![Page 10: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/10.jpg)
Intro to Unix: Essential Cmds
• cd - change directory - cd• mkdir - make a directory - md• cp - copy a file - copy• ls - list files - dir• rm - remove a file - del• mv - move a file - move & ren• grep - expression searching• top - cpu and memory usage• who/w - who else is logged in• man - read documentation
![Page 11: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/11.jpg)
Other unix commands
• where am I?
– pwd
• who is around?
– who
• where is that file?
– find <path> -name <name>
• what is the name of that file?
– grep <patern> <files>
![Page 12: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/12.jpg)
Using find and grep with wildcards• we can use “wildcard”characters to make searches more general
• “*” is the main one, means any set of characthers
• ex:
– find /home/brian -name “*.ppt” : finds all powerpoint files in the account
– grep human *.txt : look for the word “human” in all the files in my directory.
![Page 13: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/13.jpg)
Pipes & redirects
• Pipes are used to pass the output from one Unix command as the input to another Unix command.
ls | grep “mmk”
• Redirects are used to pass the output of a Unix command into a file.
ls > directory_listing
![Page 14: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/14.jpg)
Text Editors
• Crucial tools for using Unix• Two main editors
– emacs– vi
• Great features in both:– Syntax highlighting– Brace matching– Sophisticated text manipulation/movement– Scriptable– …
![Page 15: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/15.jpg)
EMACS
Ashish GuptaTA , Intro to Networking
Jan 14 2004Recital 2
Introduction to Networking , Instructor: Prof. Yan Chen
![Page 16: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/16.jpg)
Text Editors: emacs
• Configurable, extensible, complicated
• emacs and xemacs
![Page 17: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/17.jpg)
Using emacs
• to start emacs just “call it” typing
emacs
• basic editing in emacs is very intuitive
– use arrows, “pg up”and “pg down”to move cursor
– use del key to delete
– back key to delete backwards
– typing insert text at the cursor position
• to edit an existing file type
emacs <name of the file>
![Page 18: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/18.jpg)
Using Emacs: keyboard commands
• there are some keyboard commands you need to know
• we use the folowing abreviations
– “C” is the “Control” key
– “M” is the “Esc”key
– “-” between two letters mean both have to be pressed simoutaniously
• Some basic commands
– C-x, C-s - save the file
– C-x, C-c - exit Emacs
![Page 19: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/19.jpg)
Using Emacs: the minibuffer
• if you look at your screen you see a solid bar in the bottom of your page
• underneath this bar is the “minibuffer”
• the “minibuffer” is used for the communication between you and Emacs
- emacs prints messages there
– you type text that emacs needs to perform a command
– you can type commands here
![Page 20: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/20.jpg)
Commands that use the minibuffer
• C-x C-w “save as” - you type the new name in the minbuffer
• C-x C-f load a new file in Emacs
• C-s : search for a string
– this search is incremental and goes as you search
– typing C-s again will search for the next occurrence of the same string
– to go back to the editing, just press any arrow key
– after you go back, typing C-s twice resumes the search
![Page 21: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/21.jpg)
![Page 22: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/22.jpg)
GCC and make
Ashish GuptaTA , Intro to Networking
Jan 14 2004Recital 2
Introduction to Networking , Instructor: Prof. Yan Chen
![Page 23: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/23.jpg)
Development tools in UNIX
• Creation of source files (.c, .h, .cpp)– Text editors (e.g. vi)– Revision control systems (e.g. cvs)
• Compilation (e.g. *.c *.o) and linking– Compilers (e.g. gcc)– Automatic building tools (e.g. make)
• Running and testing programs– Debuggers (e.g. gdb)
![Page 24: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/24.jpg)
![Page 25: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/25.jpg)
![Page 26: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/26.jpg)
![Page 27: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/27.jpg)
![Page 28: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/28.jpg)
![Page 29: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/29.jpg)
![Page 30: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/30.jpg)
![Page 31: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/31.jpg)
![Page 32: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/32.jpg)
![Page 33: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/33.jpg)
![Page 34: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/34.jpg)
![Page 35: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/35.jpg)
![Page 36: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/36.jpg)
![Page 37: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/37.jpg)
![Page 38: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/38.jpg)
![Page 39: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/39.jpg)
![Page 40: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/40.jpg)
![Page 41: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/41.jpg)
![Page 42: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/42.jpg)
![Page 43: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/43.jpg)
![Page 44: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/44.jpg)
![Page 45: THE UNIX SYSTEM Ashish Gupta TA, Intro to Networking Jan 14 2004 Recital 2 Introduction to Networking, Instructor: Prof. Yan Chen](https://reader030.vdocuments.mx/reader030/viewer/2022032703/56649d395503460f94a13227/html5/thumbnails/45.jpg)
Links
• http://acm.cs.virginia.edu/archives/events/workshop/unix/
• http://courses.cs.vt.edu/~cs2204/spring2002/schedule.html
• http://www.cs.toronto.edu/~culhane/Teaching/209-Fall97/Slides/