Natawut NupairojAssembly Language1 Unix Survival Guide
Natawut NupairojAssembly Language2 What is Unix ? Very popular OS. (Solaris, HP/UX, Ultrix, Linux, FreeBSD, etc.) Being used in many medium-end/high-end servers. Very stable, flexible, portable.
Natawut NupairojAssembly Language3 Why do you need to care ? Good question! It is Windows’ world anyway. WRONG! –A lot of servers are Unix-based. –Unix is older than Windows but yet it still has the old basic concepts. –Unix is considered to be “cleaner” than Windows in term of coding. –Unix is still more secured than Windows. –Most of network devices are Unix-based (e.g. routers, caches, mail servers, security servers). –You can find a job with good pay with Unix.
Natawut NupairojAssembly Language4 Unix History Born in 1969 as a child of project called “Multrics” (by Bell Labs, GE, and MIT). Its famous parents: Ken Thompson and Dennis Ritchie. Its famous sibling (and supporter): C language (by Brian Kennigan and Dennis Ritchie). First machine: DEC’s PDP-7. First game on Unix: “space travel”. Famous game on early Unix: “rogue”.
Natawut NupairojAssembly Language5 Unix Features Why is it so popular ? –Multitasking. –Multiuser. –Portability. –Network applications.
Natawut NupairojAssembly Language6 Basic Skills for this Class Basic Unix operations: login, logout, directory Basic Unix commands: man, ls, cd, pwd, rm, mv, cat, more Editing commands: pico, vi Assembler / Debugger: as, ld, gcc, gdb Which computer you can use ? –Remote login (using telnet or secure shell). –cpu200, zeus, and athena.
Natawut NupairojAssembly Language7 Basic Unix Operations Start using the system: login login: natawut Password: Last login: Mon Aug 12 22:37:02 from zeus.cp.eng.chula $ Quitting from the system: logout $ logout ALWAYS LOGOUT !!! –Can use “exit” or CTRL-D.
Natawut NupairojAssembly Language8 Editing Keys When entering a command at the shell prompt: –erase one character: ctrl-H / backspace –erase the whole line: ctrl-U –stop execution: ctrl-C –pause output to the screen: ctrl-S –resume after a pause: ctrl-Q
Natawut NupairojAssembly Language9 Directory Structure All files are organized in “(sub)directory” (folders). –hierarchy: current directory, parent directory, root directory –path reference: absolute, relative
Natawut NupairojAssembly Language10 Basic Unix Commands Getting help: man (manual) $ man ls $ man man format: man
Natawut NupairojAssembly Language11 Basic Unix Commands (cont’) Listing all the files: ls $ ls Admin Class bin public_html options: ls -l, ls -a, ls -al, ls $ ls –l Class $ ls –al.. format: ls [-laCFR]
Natawut NupairojAssembly Language12 Basic Unix Commands (cont’) Understand permissions: $ ls -l total 168 drwxr-xr-x 3 natawut faculty 4096 Aug 5 16:24 Class drwxr-xr-x 2 natawut faculty 4096 Jul 10 00:25 Images drwxr-xr-x 2 natawut faculty 4096 Jul 10 00:25 Library drwxr-xr-x 8 natawut faculty 4096 Jan Old drwxr-xr-x 2 natawut faculty 4096 Aug 5 16:09 Publications drwxr-xr-x 2 natawut faculty 4096 Aug 1 01:04 Templates -rw-r--r-- 1 natawut faculty 4800 Aug 1 01:05 class.html -rw-r--r-- 1 natawut faculty 4551 Aug 1 01:17 contact.html -rw-r--r-- 1 natawut faculty 5817 Aug 1 01:21 home.html -rw-r--r-- 1 natawut faculty 3343 Feb 19 17:15 index.html...
Natawut NupairojAssembly Language13 Basic Unix Commands (cont’) Finding out where I am: pwd (print working directory) $ pwd /home/natawut Walking around: cd (changing directory) $ cd Admin $ pwd /home/natawut/Admin
Natawut NupairojAssembly Language14 Basic Unix Commands (cont’) change to parent directory, root directory. $ pwd /home/natawut/Admin $ cd.. $ pwd /home/natawut $ cd / $ pwd / $ cd $ pwd /home/natawut
Natawut NupairojAssembly Language15 Basic Unix Commands (cont’) change to absolute path, relative path. $ pwd /home/natawut $ cd public_html/Class $ pwd /home/natawut/public_html/Class $ cd /usr $ pwd /usr $ cd $ pwd /home/natawut $ cd../../usr $ pwd /usr
Natawut NupairojAssembly Language16 Basic Unix Commands (cont’) Deleting stuffs: rm (remove) $ rm hw1.asm Changing a file’s name / Moving things around: mv (move) $ mv hw1.asm h1.abc $ mv h1.abc Class $ mv h1.abc Class/hw1.txt
Natawut NupairojAssembly Language17 Basic Unix Commands (cont’) Displaying file’s content: cat $ cat hw1.asm A better version than cat: more $ more hw1.asm
Natawut NupairojAssembly Language18 Editing Files in Unix Several editing programs: pico, vi, emacs Simple editor: pico –Available only on cpu200. –Similar to “Notepad” program on Windows. For advance users: vi and emacs
Natawut NupairojAssembly Language19 References “man” pages. Grace Todino et. al., Learning the UNIX Operating System, O’Reilly&Associates, Inc. Other Unix books. Links in my homepage.