270 likes | 405 Views
Chapter 1. Linux/Unix Environment and basic commands Digital Image Processing Instructor: Dr. Cheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 21 September 2003. Introduction. References Teach yourself UNIX in 24 hours, SAMS
E N D
Chapter 1 Linux/Unix Environment and basic commands Digital Image Processing Instructor: Dr. Cheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 21September 2003
Introduction • References • Teach yourself UNIX in 24 hours, SAMS • Linux Mandrake 9.1 實務應用,旗標 • History of UNIX • History of Linux • Why UNIX • Why Linux • Where to get Linux • How to install Linux
Start • No power on/off • login • logout • passwd • whoami • id • users • who • w
Start (cont.) • time • date • hostname • exit
Move • ls • ls –C -F • ls –a • Dot files • Directory • / • . • .. • cd
File system • Directory • bin • dev • etc • lib • lost+found • mnt • sys • tmp • usr • users
Shell environment variables • echo $VARIABLE • PATH • HOME • SHELL • TERM • MAIL • LOGNAME • TZ • pwd • Take a look around
Move further • Directory • bin • dev • etc • lib • lost+found • mnt • sys • tmp • usr • users
Help • man • help • -h • -? • whatis
ls • Flag • -l • -a • -C • -d • -F • -l • -m • -r • -R • -s
Permission • ls -l • Permission • Type • Owner • Group • Other • Permission mode • r • w • x
Change Permission • chmod • Symbol • ugoa • +- • rwx • Digit • --- 0 • --x 1 • -w- 2 • -wx 3 • r-x 5 • rw- 6 • rwx 7
Change Permission • Permission • Type • Owner • Group • Domain • e.g. ls -l • Access permission • r • w • x • e.g. everybody can access
Some useful commands • touch • du • df • compress • umask
Manage files • mkdir • cp • mv • rmdir • rm • -i • -r
Manage files (cont.) • file • Not accurate • No need to open files • head • tail • cat • more
Filters and pipes • Redirection • > • >> • < • << • | • wc • -l • -w • -c
Filters and pipes (cont.) • uniq • -u • -d • -c • sort • -b • -d • -f • -n • -r
grep • Difference between * and ? • Use echo to test • Regular expression • c • \c • ^ • $ • . • [xy] • [^xy] • c*
grep (cont.) • Difference between * and ? • Use echo to test
Text Editor • emacs • vi • Basic commands • http://www.badmagicnumber.com/vi/
C shell • echo $SHELL • ls –a • cat .cshrc • vi .cshrc • stty erase ^H • history • alias • g77
Telnet • telnet 140.116.24.47 • Setup your password • logout • telnet again using your new password
ftp • ftp 140.116.24.47 • Basic commands • pwd • ls • cd • lcd • ascii (a) • binary (bin) • get • put
ftp (cont.) • Basic commands (cont.) • mget • mput • bye • Anonymous FTP • Username: anonymous • Password: (email address)
Supplements • http://www2.stat.tku.edu.tw/document/Linux/unix.PDF • http://packet.int.hit.edu.tw/jychen/Course/SiteManage/PPT/UnixCMD.ppt • http://www.ccu.edu.tw/center/ycnet/seminar/unix90.pdf
Exercises • Setup your best shell environment • (alias, path, erase, …) • Make yourself familiar with basic commands of vi • Find the location of files by their name or contexts • Manage your own directory and files • Change permission • Use telnet and ftp