Скачать презентацию Linux Basics Wee San Lee weesan cs ucr edu Скачать презентацию Linux Basics Wee San Lee weesan cs ucr edu

6a4b06d0334eda486e668716d1d0232e.ppt

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

Linux Basics Wee. San Lee <weesan@cs. ucr. edu> http: //www. cs. ucr. edu/~weesan/cs 183/ Linux Basics Wee. San Lee http: //www. cs. ucr. edu/~weesan/cs 183/

Roadmap n n n n What is Unix? What is Linux? Which Linux Distribution Roadmap n n n n What is Unix? What is Linux? Which Linux Distribution is better? Fish vs. Fishing Basic Commands Vi and Emacs Q&A References http: //www. cs. ucr. edu/~weesan/cs 183/

What is Unix? n n A multi-task and multi-user Operating System Developed in 1969 What is Unix? n n A multi-task and multi-user Operating System Developed in 1969 at AT&T’s Bell Labs by q q q n Ken Thompson (Unix) Dennis Ritchie (C) Douglas Mcllroy (Pipes - Do one thing, do it well) Some other variants: System V, Solaris, SCO Unix, Sun. OS, 4. 4 BSD, Free. BSD, Net. BSD, Open. BSD, BSDI http: //www. cs. ucr. edu/~weesan/cs 183/

What is Linux? n n n A clone of Unix Developed in 1991 by What is Linux? n n n A clone of Unix Developed in 1991 by Linus Torvalds, a Finnish graduate student Inspired by and replacement of Minix Linus' Minix became Linux Consist of q q Linux Kernel GNU (GNU is Not Unix) Software Package management Others http: //www. cs. ucr. edu/~weesan/cs 183/ http: //www. linuxdevices. com/files/misc/ibm-watchpad. jpg

What is Linux? n n Originally developed for 32 -bit x 86 -based PC What is Linux? n n Originally developed for 32 -bit x 86 -based PC Ported to other architectures, eg. q q Alpha, VAX, Power. PC, IBM S/390, MIPS, IA-64 PS 2, Ti. Vo, cellphones, watches, Nokia N 810, NDS, routers, NAS, GPS, … http: //www. cs. ucr. edu/~weesan/cs 183/ * See references at the end for the corresponding websites.

Which Linux Distribution is better? n > 300 Linux Distributions q q Slackware (one Which Linux Distribution is better? n > 300 Linux Distributions q q Slackware (one of the oldest, simple and stable distro. ) Redhat n n q q q q RHEL (commercially support) Fedora (free) Cent. OS (free RHEL, based in England) Su. Se ( based in German) Gentoo (Source code based) Debian (one of the few called GNU/Linux) Ubuntu (based in South Africa) Knoppix (first Live. CD distro. ) … http: //www. cs. ucr. edu/~weesan/cs 183/

Which Linux Distribution is better? Ubuntu Debian Knoppix Slackware Gentoo Cent. OS Redhat Source: Which Linux Distribution is better? Ubuntu Debian Knoppix Slackware Gentoo Cent. OS Redhat Source: http: //futurist. se/gldt/ http: //www. cs. ucr. edu/~weesan/cs 183/

Which Linux Distribution is better? n Ask yourself these questions (from LAH) q q Which Linux Distribution is better? n Ask yourself these questions (from LAH) q q n n Is it going to be around in 5 yrs? Is it giong to stay on top of the latest security patches? Is it going to release updated software promptly? If I have problems, will the vendor talk to me? Personally, I use Slackware But, we will use Cent. OS (possibly along with Slackware : ) http: //www. cs. ucr. edu/~weesan/cs 183/

Fish vs. Fishing n Manpage q q n q $ man ls $ man Fish vs. Fishing n Manpage q q n q $ man ls $ man 2 mkdir $ man -k mkdir n q q n q /bin/mkdir q int mkdir(const char *, …); 3 Library calls n int printf(const char *, …); n n man 7 locale 8 System admin. Cmds n n /usr/games/fortune 7 Misc. files and docs n 2 System calls n q q /etc/hosts 6 Games and demos n 1 User-level cmds and apps /dev/tty 5 Standard file formats n Manpage sections (LAH Table 1. 2 @ page 12) q 4 Device drivers and network protocols /sbin/reboot $ manpath $ env | grep MANPATH /etc/man. config http: //www. cs. ucr. edu/~weesan/cs 183/

Fish vs. Fishing (cont) n Google q q q n linux package management -rpm Fish vs. Fishing (cont) n Google q q q n linux package management -rpm “linux package management” -rpm linux OR windows rpm site: redhat. com linux faq filetype: pdf Info q q q Text-base, menu-based help from GNU ? , h, u, t, ^N, ^P, Enter $ info http: //www. cs. ucr. edu/~weesan/cs 183/

Basic Commands n ls q q q n n n q q $ cd Basic Commands n ls q q q n n n q q $ cd ~ n $ rpm -q bash $ rpm -qa | sort | less find q $ cd ~weesan $ locate stdio. h $ locate iostream rpm q $ pwd $ whereis ls locate q $ cd /usr/bin $ which ls whereis q ~user q n n ~ q which q pwd q n $ ls -l $ ls -a $ ls -l --sort=time $ ls -l --sort=size -r cd q n n q $ find / | grep stdio. h $ find /usr/include | grep stdio. h What will “cd ~/weesan” do? http: //www. cs. ucr. edu/~weesan/cs 183/

Basic Commands (cont) n echo q q n q q q n $ cp Basic Commands (cont) n echo q q n q q q n $ cp foo bar $ cp -a foo bar n $ mkdir foo $ chsh foo chfn q n $ chgrp bar /home/foo chsh q $ mv foo bar mkdir q n $ rm foo $ rm -rf foo $ rm -i foo $ rm -- -foo chgrp q mv q n $ cat /etc/motd $ cat /proc/cpuinfo rm q cp q n $ echo “Hello World” $ echo -n “Hello World” cat q n n $ chfn foo chown q $ chown -R foo: bar /home/foo http: //www. cs. ucr. edu/~weesan/cs 183/

Basic Commands (cont) n tar q n q q $ gzip -9 lab 1. Basic Commands (cont) n tar q n q q $ gzip -9 lab 1. tar q q $ gzip -cd lab 1. tar. gz | tar xvf – $ tar xvfz lab 1. tar. gz n touch q q $ touch foo $ cat /dev/null > foo Pipe q untar & ungzip q n $ tar cvfp lab 1. tar lab 1 gzip q n n backtick q q n $ cal > foo $ cat /dev/zero > foo $ cat < /etc/passwd $ who | cut -d’ ‘ -f 1 | sort | uniq | wc –l $ echo “The date is `date`” $ echo `seq 1 10` Hard, soft (symbolic) link q q ln vmlinuz-2. 6. 24. 4 vmlinuz ln -s firefox-2. 0. 0. 3 firefox http: //www. cs. ucr. edu/~weesan/cs 183/

Basic Commands (cont) n Disk usage q n File space usage q n $ Basic Commands (cont) n Disk usage q n File space usage q n $ df -h / $ du -sxh ~/ Advance stuff q q q $ ssh eon who $ ssh eon ‘cd. html ; tar cvfp - cs 183 | gzip -9 c’ | tar xvfpz $ ssh kilo-1 ‘tar cvfp - /extra/weesan’ | tar xvfp - -C / http: //www. cs. ucr. edu/~weesan/cs 183/

Vi n 2 modes q Input mode n q q ESC to back to Vi n 2 modes q Input mode n q q ESC to back to cmd mode q Command mode n q q q n q q Cursor movement q h (left), j (down), k (up), l (right) ^f (page down) ^b (page up) ^ (first char. ) $ (last char. ) G (bottom page) : 1 (goto first line) Swtch to input mode q q Delete a (append) i (insert) o (insert line after O (insert line before) n Paste q q n u Search q n p (paste after) P (paste before) Undo q n dd (delete a line) d 10 d (delete 10 lines) d$ (delete till end of line) d. G (delete till end of file) x (current char. ) / Save/Quit q q http: //www. cs. ucr. edu/~weesan/cs 183/ : w (write) : q (quit) : wq (write and quit) : q! (give up changes)

Emacs n n $ emacs Cursor movement q q q q n n q Emacs n n $ emacs Cursor movement q q q q n n q ^f (forward one char. ) ^b (backward one char. ) ^a (begin of line) ^e (end of line) ^n (next line) ^p (prev. line) ^v (page up) alt-v (page down) Deletion q q q Paste ^d (delete one char) alt-d (delete one word) ^k (delete line) n Undo q n ^x^f Cancel q n ^/ Load file q n ^y (yank) ^g Save/Quit q q q ^x^c (quit w/out saving) ^x^s (save) ^x^w (write to a new file) http: //www. cs. ucr. edu/~weesan/cs 183/

Q&A http: //www. cs. ucr. edu/~weesan/cs 183/ Q&A http: //www. cs. ucr. edu/~weesan/cs 183/

References n LAH q n Unix history q q n http: //en. wikipedia. org/wiki/Unix References n LAH q n Unix history q q n http: //en. wikipedia. org/wiki/Unix http: //upload. wikimedia. org/wikipedia/commons/7/77/Unix_ history-simple. svg Linus Torvalds q n Ch 1: Where to Start http: //en. wikipedia. org/wiki/Linus_Torvalds Linux Kernel q http: //www. kernel. org/ http: //www. cs. ucr. edu/~weesan/cs 183/

References n GNU (Gnu’s Not Unix) q n Linux Distribution q q n http: References n GNU (Gnu’s Not Unix) q n Linux Distribution q q n http: //arrakis. ncsa. uiuc. edu/ps 2/cluster. php Linux Gadgets q n http: //en. wikipedia. org/wiki/Linux_distribution http: //en. wikipedia. org/wiki/List_of_Linux_distributions PS 2: Computational Cluster q n http: //www. gnu. org/ http: //linuxdevices. com/articles/AT 4936596231. html Ti. Vo q http: //dynamic. tivo. com/linux. asp http: //www. cs. ucr. edu/~weesan/cs 183/

References n n Nintendo DS Lite q http: //www. nintendo. com/ds/ Nokia N 810 References n n Nintendo DS Lite q http: //www. nintendo. com/ds/ Nokia N 810 q http: //www. nokia. com/ q http: //www. engadget. com/2007/10/17/nokia-n 810 -gets-official/ Linux Distribution q http: //en. wikipedia. org/wiki/Linux_distribution q GNU/Linux Distro Timeline: http: //futurist. se/gldt/ q http: //www. distrowatch. com/ q http: //www. linux. org/dist/ Google Advance Search q http: //www. google. com/intl/en/help/refinesearch. html http: //www. cs. ucr. edu/~weesan/cs 183/