5 / 5.1 L i n u x L i n u x X L i n u x 5.1.1 touch t o u c h t o u c h G N U t o u c h # touch newfile # ls -l newfile - r w - r - - r - - 1 bball users 0 Jan 5 12 : 40 n e w f i l e t o u c h 0 # > newfile2 # ls -l new* - r w - r - - r - - 1 bball users 0 Jan 5 12 : 40 n e w f i l e - r w - r - - r - - 1 bball users 0 Jan 5 12 : 41 n e w f i l e 2 t o u c h 0 t o u c h t o u c h t o u c h # touch newfile2 # ls -l newfile2 - r w - r - - r - - 1 bball users 0 Jan 5 12 : 44 n e w f i l e 2 n e w f i l e 2 12 : 41 12 : 44 t o u c h - t # touch -t 1225130000 newfile2
64 L i n u x # ls -l --full-time new* - r w - r - - r - - 1 bball users 0 Tue Jan 05 12 : 40 : 14 1999 n e w f i l e - r w - r - - r - - 1 bball users 0 Mon Dec 25 13 : 00 : 00 2000 n e w f i l e 2 l s -- f u l l - t i m e n e w f i l e 2 2000 t o u c h t o u c h t o u c h c r o n 24 cron 5.1.2 rm r m r m m c r m L i n u x D O S R A M # rm -fr /* - r / L i n u x 23 r m # rm file # rm file1 file2 file3 # rm file* f i l e f i l e r m - i # rm -i new* rm : remove newfile? y rm : remove newfile2? y - f # rm -f new* - f n e w * r m r m
5 65 # rm -f temp* rm : temp : is a directory rm : temp2 : is a directory - f - f - r 22 - f - r # rm -fr temp* - f r r m r m d i r O p e n L i n u x X K D E S t a r O ff i c e m c Midnight Commander 5.1.3 mkdir m k d i r m k d i c p m v # mkdir temp # mkdir temp2 temp3 temp4 t e m p c h i l d # mkdir temp/child t e m p # mkdir temp5/child mkdir : cannot make directory temp5/child : No such file or directory m k d i r t e m p 5 m k d i r - p
66 L i n u x 2 directories, 0 files m k d i r t e m p 5 p a r e n t p a r e n t c h i l d 5.1.4 rmdir r m d i r # rmdir tempdirectory # rmdir temp5 rmdir : temp5 : Directory not empty t e m p 5 r m d i r r m -fr m v m v m k d i r r m d i r - p # rmdir -p temp5 rmdir : temp5 : Directory not empty! # rmdir -p temp5/parent rmdir : temp5/parent : Directory not empty # rmdir -p temp5/* rmdir : temp5/parent : Directory not empty # rmdir -p temp5/parent/child! - p c h i l d 3 directories, 0 files t e m p 5 # rmdir temp5/parent/* m v
5 67 5.1.5 mv m v L i n u x S A G S A h t t p / / m e t a l a b. u n c. e d u / L D P / L D P / s a g / i n d e x. h t m l S A G O p e n L i n u x l y n x lynx /usr/doc/ldp/system-admin-guide/sga-0.6-html/sag.html l y n x 13 m v # touch file1 # mv file1 file2 f i l e 1 f i l e 2 m v m k d i r m v # mkdir -p temp/temp2/temp3 # mv temp newtemp m v 9 - b - i m v m v - b - b m v u n o d e u x d e u? - b u n o d e u x d e u ~ m v r m - i
68 L i n u x f i l e 2 f i l e 3 f i l e 3 - i m v f i l e 3 - i m v - i - b # mv -bi file2 file3 5.1.6 cp c p 40 c p # cp file1 file2 f i l e 1 f i l e 2 f i l e 1 c p c p m v c a t # cat > file1 this is file1 # cat > file 2 this is file2 # cat > file3 this is the third file # ls -l file* - r w - r - - r - - 1 bball users 14 Jan 5 13 : 29 f i l e 1 - r w - r - - r - - 1 bball users 15 Jan 5 13 : 29 f i l e 2 - r w - r - - r - - 1 bball users 23 Jan 5 13 : 29 f i l e 3 # cp file1 file2 # ls -l file* - r w - r - - r - - 1 bball users 14 Jan 5 13 : 29 file1 - r w - r - - r - - 1 bball users 14 Jan 5 13 : 31 f i l e 2 - r w - r - - r - - 1 bball users 14 Jan 5 13 : 29 f i l e 3 # cat file2 this is file1 f i l e 1 f i l e 2 m v - i - b # cp -i file1 file2 cp : overwrite file2? n
5 69 # cp -bi file1 file2 cp : overwrite file2? y # ls file* f i l e 1f i l e 2 f i l e 2 ~ f i l e 3 f i l e 2 c p t e m p d i r 1 t e m p d i r 2 r m c p - r t e m p d i r 1 t e m p d i r 2 c p - p m k d i r - p t e m p 1 f i l e 1 t e m p d i r 3 1 directory, 6 files # cp tempdir2/tempdir1/temp1file1 tempdir3 - p
70 L i n u x c p 5.1.7 ln L i n u x L i n u L i n u x l n l n O p e n L i n u x l n f i l e 2 f i l e 1 f i l e f i l e 2 f i l e 1 f i l e 2 f i l e 2 f i l e 1 l n - s f i l e 2 f i l e 1 f i l e 2 f i l e 1 f i l e 2 f i l e 1 a l i a s # rm -f file1 # cat file2 cat : file2 : No such file or directory f i l e 1 f i l e 2 O p e n L i n u x
5 71 # ln /usr/local/games play ln : /usr/local/games : hard link not allowed for directory / u s r / l o c a l / g a m e s l n # ln -s /usr/local/games play # ls -l play l r w x r w x r w x 1 bball u s e r s 16 Jan 5 14 : 12 play -> /usr/local/games # cd /usr/local/games # cd play / u s r / l o c a l / g a m e s D O S Wi n d o w s d o s / m n t / d o s / w i n d o w s / d e s k t o p L i n u x Wi n d o w s d o s D O S / m n t / d o s D O S l n # ln -s /mnt/dos/windows/desktop dos 22 m c 5.1.8 Midnight Commander m c Midnight Commander 5-1 s h e l l s h e l l s h e l m c # mc m c s h e l l l s c p l n m v m k d i r r m d i r r m c d p w d f i n d c h o w n c h g r p
72 L i n u x t r e e t e l n e t F T P g z i p L i n u x Midnight Commander 5-1 Midnight Commander s h e l l L i n u x 5.2 g r e p L i n u x 5.2.1 5-1 *
5 73 5-1 *?. { x } x { x, y } x y { x, } x ( xxx ) ( XXX ) x x x X X X [ xxx ] x-x ] [ XYZ ]+ X Y Z \ x? ^ pattern $ pattern e d e d. t x t # ls *.txt 1 4 d a y s. t x t 9 6 h o u r s. t x t d a t a l o g. t x t d a t e b o o k. t x t d a y 6 7. t x t l s l s # ls *[ 0123456789 ]* 0 0 0 1 f i l e. 0 0 0 9 3 2 d a y s. m s g d a y 6 7. t x t 0 8 1 0 0 0 9 7. d b 9 6 h o u r s. t x t m e s s a g e. 7 6 1 4 d a y s. t x t b a c k u p 0 0 1. f i l e p h o n e l o g. 111 5 9 7 # ls *[ 0-9 ]* 0 0 0 1 f i l e. 0 0 0 9 3 2 d a y s. m s g d a y 6 7. t x t 0 8 1 0 0 0 9 7. d b 9 6 h o u r s. t x t m e s s a g e. 7 6 1 4 d a y s. t x t b a c k u p 0 0 1. f i l e p h o n e l o g. 111 5 9 7 # ls *[ 0-9 ]
74 L i n u x 0 0 0 1 f i l e. 0 0 0 9 m e s s a g e. 7 6 p h o n e l o g. 111 5 9 7 # ls [ 0-9 ]* 0 0 0 1 f i l e. 0 0 0 9 0 8 1 0 0 0 9 7. d b 1 4 d a y s. t x t 3 2 d a y s. m s g 9 6 h o u r s. t x t # ls *[ -a-z ]* [ 0-9 ]* b a c k u p 0 0 1. f i l e # ls [ 0-9 ]*[ a-z ]*[ 0-9 ] 0 0 0 1 f i l e. 0 0 0 9 d a y 6 7. t x t? # ls *\?* c a t h y?. m e s s a g e 5.2.2 grep g r e p g r e p e g r e f g r e p g r e p e g r e p f g r e g r e p Matt We l s h L i n u x h t t p :// m e t a l a b. u n c. e d u / L D P O p e n L i n u x / u s r / d o s / L D P g r e p e g r e p f g r e p f g r e p
5 75 # fgrep friend guide.txt Large extent by the window manager. This friendly program is in copy Linux from a friend who may already have the software, or share ( Unfortunately, the system was being unfriendly.) e g r e p ( b ) # egrep \([b]\) g u i d e. t x t ( see section 1.8 for a list of compatible boards ), or (b) there is an connect to the network, or (b) you have a dynamic IP address, ( b ) g r e p # grep \([b]\) g u i d e. t x t This is version 2.2.2 of the book, Linux Installation and Getting to PostScript printers. This document was generated by a set of tools from LaTeX source, so there may be a number of formatting problems. This is not the o fficial version of the book! Please see... g r e p e g r e p # grep (b) g u i d e. t x t ( see Section 1.8 for a list of compatible boards ), or (b) there is an connect to the network, or (b) you have a dynamic IP address, g r e p f g r e p e g r e p g r e p b g r e p - n g r e p # egrep -n friend g u i d e. t x t 1242 : large extent by the window manager. This friendly program is 1942 : copy Linux from a friend who may already have the software, or 5161 : ( Unfortunately, the system was being unfriendly.) 1242 1 942 5 161 g r e p - f - n - f g r e p n
76 L i n u x g r e p - F f g r e p - E e g r e p g r e z g r e 5.3 5.3.1 t a r t a r L i n u x t a r O p e n L i n u x C D - R O M r p m t a r t a r - z g z i p g z i p t a r c f t a r # tar cf mydir.tar mydir # ls -l *.tar - r w - r - - r - - 1 bball u s e r s 10240 Jan 5 15 : 01 mydir. t a r t a r
5 77 - - r e m o v e - f i l e s v t a r w t a r f i l e 1 f i l e 3 f i l e 22? t a r t f t a r g r e p t a r - x - f - v w
78 L i n u x # tar xf mydir.tar mydir/mydir2/file23 # tree mydir m y d i r ` - - mydir2 ` - - file23 1 directory, 1 file m y d i r t a r t a r c p i o B R U - 2000 t a p e r O p e n L i n u x c r o n 23 B R U - 2000 t a p e r 24 c r o n 5.3.2 cpio c p i o t a r c p i o c p i t a r t a r c p i o t a r L i n u x c p i o c p i o c p i o c p i o 5.3.3 gzip g z i p t a r L i n u x L i n u x. t g z. t a r. g z / u s r / d o c / H O W TO g z i p g z i p g z i 60 7 0
5 79 g z i p # gzip mydir. t a r g z i p. g z g z i p g u n z i g z i p - d. g z. Z - g z. z - z _ z g z i p g u n z i p - S # gzip -S.gzipped mydir. t a r g z i p z i c o m p r e s s p a c k - l m y d i r g z i p # gzip -l mydir. t a r. g z compressed uncompr. ratio uncompressed_name 239 10240 97.9% mydir. t a r g z i p - t g z i p O K - t v 5.3.4 compress c o m p r e s s U N I X c o m p r e s s. Z # compress file # uncompress file.z g z i p. Z c o m p r e s s L i n u x z i p u n z i p z i p c l o a k z i p n o t e z i p s p l i t z l e s s z c a t z n e w z m o r e z c m p p a c k c o m p a c t s h a r u n s h a r z f o r c e L i n u x h t t p : / / m e t a l a b. u n c. e d u / p u b / L i n u x 5.4 O p e n L i n u x O p e n L i n u x
80 L i n u x 5.5 O p e n L i n u x b z i p 2 g z i p / b i n O p e n L i n u x. b z 2. u u. u u u u e n c o d e u u d e c o d e uudecode somefile.uu U s e n e t U s e n e t c a t l e s s s t r i n g s l e s s t r i n g s s h e l l t t a r v t 5.6 1. tar t a 2. OpenLinux a p r o p o s 3. O p e n L i n u x