190 likes | 206 Views
Unix Survival Guide. 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. Why do you need to care ?. Good question! It is Windows’ world anyway. WRONG!
E N D
Unix Survival Guide Assembly Language
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. Assembly Language
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. Assembly Language
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”. Assembly Language
Unix Features • Why is it so popular ? • Multitasking. • Multiuser. • Portability. • Network applications. Assembly Language
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. Assembly Language
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. Assembly Language
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 Assembly Language
Directory Structure • All files are organized in “(sub)directory” (folders). • hierarchy: current directory, parent directory, root directory • path reference: absolute, relative Assembly Language
Basic Unix Commands • Getting help: man (manual) $ man ls $ man man • format: man <command> Assembly Language
Basic Unix Commands (cont’) • Listing all the files: ls $ ls Admin Class bin public_html • options: ls -l, ls -a, ls -al, ls <directory> $ ls –l Class $ ls –al .. • format: ls [-laCFR] <directory> Assembly Language
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 26 2002 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 ... Assembly Language
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 Assembly Language
Basic Unix Commands (cont’) • change to parent directory, root directory. $ pwd /home/natawut/Admin $ cd .. $ pwd /home/natawut $ cd / $ pwd / $ cd $ pwd /home/natawut Assembly Language
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 Assembly Language
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 Assembly Language
Basic Unix Commands (cont’) • Displaying file’s content: cat $ cat hw1.asm • A better version than cat: more $ more hw1.asm Assembly Language
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 Assembly Language
References • “man” pages. • Grace Todino et. al., Learning the UNIX Operating System, O’Reilly&Associates, Inc. • Other Unix books. • Links in my homepage. http://www.cp.eng.chula.ac.th/~natawut Assembly Language