Linux
vi shell Linux
Linux Linux 5
UNIX time-stamp UNICS Sep 1969... UNIX Time- Sharing System First Edition(V1) Nov 3, 1971 FreeBSD 5.1 Jun 9,2003 BSD/OS 5.0 (BSDI) May 2,2003... V6 May 1976 BSD 1977... Version7 1979 OpenBSD 3.4 beta Aug 11,2003 Solaris 10 Preview Jul 29,2003... 4.4 BSD 1993 System V Release 4 (SVR 4) 1988 HP-UX 11i v2 for Intel Itanium May 19,2003 IRIX 6.5.20 May 7,2003 Mac OS X 10.2.7 Aug 18,2003 AIX 5L v5.2 Update May 23,2003 NetBSD 1.6.1 Apr 14,2003 True Unix V5.1B Jan 20,2003 SCO UnixWare 7.1.3/OKP Jul 31,2003 6
Linus Torvalds Alan Cox 1969.12.28 Helsinki, Finland Richard Stallman Eric Raymond Gnu(Gnu is Not Unix),FSF 7
Linus version 2.0 8
Open Source Open Source 9
Open Source 10
Open Source http://www.gnu.org http://www.tldp.org http://www.kernel.org http://www.linux.org http://www.linuxforum.org http://www.redhat.com http://www.apache.org http://www.samba.org http://www.linuxaid.org http://www.oreilly.com http://www.oreilly.com.cn Tim Oreilly 11
Linux Shell 12
Linux (Distributions) (SuSE,SCO,TurboLinux,Conectivia) 13
kernel 2.4.18-4 2.5.23-32 / patch 2.4.22 2003 8 29 beta 2.6.0-test4 2003 8 29 http://www.kernel.org 14
Linux time-stamp Linux 0.01 Aug 1, 1991 Linux 1.0...... Aug 1, 1994 Linux 1.0.6 Apr 3, 1994 Linux 1.0.9 Apr 17, 1994... Linux 1.2 Mar 7, 1995 Linux 1.1.0 Apr 6, 1994... Linux 1.1.95 Mar 2, 1995 Linux 1.2 Mar 7, 1995 Linux 1.2.13 Aug 2, 1995... Linux 1.3 Jun 12, 1995...... Linux 2.2.25 Mar 17, 2003 Linux 2.4.21 Jun 13, 2003 Linux 2.5.75 Jul 10, 2003 Linux 2.6.1-test1 Jul 13, 2003 15
Shell Shell Bourne Shell sh Steve Bourne Bourne Again Shell bash Korn Shell ksh Korn C Shell csh BSD tcsh tcsh BSD Shell ---- bash Shell 16
Linux Windows Linux shell 17
root Linux 19
root root UNIX script 20
telnet NIS(Network Information System) rsh 21
IP telnet VIP VIP Login: root Password: 22
#rsh c0305 ( rsh,c0305 ) $exit $logout ctrl-d $ %, # 23
: passwd $passwd yangkun s old password: yangkun s new password: Enter the new password again: 24
$command options arguments $ls l news $mail -f newmail ( ) $mail - f newmail $mail -f newmail $mail newmail -f ( ) ( ) ( ) options $who -m -u $who -mu $who -m-u $who -m u ( ) ( ) 25
shell Enter shell ls LS Ls ls \ Enter > 26
Ctrl-c Ctrl-d Ctrl-s Ctrl-q Ctrl-u Ctrl-l backspace 27
Linux 29
/ /tmp /bin /home /etc /usr /var yang zhang share man data 30
Linux / /home /bin /sbin /usr /usr/bin /usr/sbin /usr/lib /usr/doc Linux /usr/man /usr/spool 31
Linux /var /dev /etc 32
255 / /usr/share/doc 33
- inode index node - 34
Linux 26 # @ _ *? > < / ; $ \ + - 255 35
txt,pdf,jpg /dev/tty1 #file // 36
ASCII 37
i / i i i 38
/ /etc, /usr/share pwd./ /home/yang./data/today data/today /home/yang/data/today ( /home/yang) $cd /home/yang/data/today $cd data/today $cd./data/today 39
ls pwd cd mkdir rmdir 40
ls list ls 26-1 -a.... -l -R 41
ls [root@lenovo /root ]# ls la t [root@lenovo /root ]# ls t* 42
pwd Print Working Directory 43
cd Changing Directory cd cd [ ] cd ~ $cd $cd ~ $cd /usr/share $cd.. // // // /usr/share // 44
mkdir Make Directory mkdir mkdir [-p] [-m][ ] -p -m chmod 45
mkdir( ) data, rwx $mkdir m 777 data /home/yang/data /home #mkdir p /home/yang/data // shell # 46
rmdir Remove Directory rmdir rmdir [-p] [ ] -p new data data new #rmdir p new/data 47
cp mv rm ln find touch 48
cp copy cp cp [ ] [ ] cp r [ ] [ ] file1,file2 data data new $cp file1 file2 data $cp file* data $cp r data new 49
mv move mv, mv [ ] [ ] file1 $mv file1 file data file1 file2 new $mv data/file1 file2 /new 50
rm remove rm [ ][ ] -r -i file1 $rm file1 /home/yang/data $rm rf /home/yang/data 51
ln link ln ln [ ] ln [ ] -s -d file1,file2 data, new $ln s /home/file1 /home/file2 /home/data new dir3 dir4 $ln d dir3 dir4 52
find find find [ ] [ ] locate,whereis 53
find -atime n -ctime n -amin n -cmin n -empty -name name -type x n*24 n*24 n n x d, f x c, x b, x p x l, x s 54
find /home 7 : $find /home -atime 7 -print /usr/src core $find /usr/src -name core -exec rm { } \ ; /home.jpg 100K $find /home -name " *.jpg " -size 100k 55
touch touch [ ] [YY]MMDDhhmm -a -c -t touch $touch foo $touch t 9802231245 foo 56
cat more head tail 57
concatenate cat cat [ ] [ ] cat $cat 123 123 file1 file2 file3 $ cat file1 file2 > file3 file3 58
more more more [ ] [ ], less +/< > +< > -n n -c foo cpu $more +/cpu foo foo 10 $more c 10 foo 59
head 10 head [ ] -c N N -n N N foo 5 $head 5 foo 60
tail 10 tail [ ] -c N N -n N N +N N 61
comm diff 62
comm common) comm [-123] file1 file2 63 (in -1-2 -3 comm $comm 12 file1 file2 file1 file2 hello hello hello good goodbye hi hi hi
diff differences diff [ ] file1 file2 -c -C n n -r n1 a n3,n4 n1,n2 d n3 n1,n2 c n3,n4 a- d- c- 64
diff $diff file1 file2 file1 file2 1 hello 1 hello 2c2 2 good 2 goodbye < good 3 hi 3 hi --- 4 This is a try. 4 Me too. > goodbye 4c4 < This is a tr --- > Me too. 65
chmod chown chgrp 66
rwx rwx rwx user group others r w x 67
7 6 4 user group others rwx rw- r-- 111 110 100 4+2+1 4+2+0 4+0+0 umask file -rw-r--r-- 644 directory drwxr-xr-x 755 68
chmod change mode chmod [ ] u g o + - = 69
chmod filename $chmod 777 filename filename, $chmod 644 filename $chmod a+w filename $chmod o-wr,g-wr filename $chmod o=r filename 70
chown change owner chown chmod [ ] -v -r 71
change group chgrp chgrp chgrp [ ] -v -r 72
vi
vi visual editor ex <<UNIX is a Four Letter Word... and Vi is a Two Letter Abbreviation>> Vim (Vi IMproved) 74
75
vi #vi filename ~ ~ ~ ~ file [New file] 76
vi Esc Ctrl-[ :q :q! vi :x vi :wq vi shift Z :wq 77
i I (insert) a A (append) o O (open) 78
<up_arrow> Ctrl+P - k <left-arrow> Backspace h l <right-arrow> Space + j Ctrl+N <down-arrow> 79
^ 0 $ [ ] G [ ] [Enter] [ ] 80
x nx n X nx n dd D dw d0 d5g 5 81
u U 82
. #include <stdio.h> main () { } 83
o Esc #include <stdio.h> { main () printf(); }. #include <stdio.h> { } main () printf(); printf(); printf(); 84
Ctrl+U Ctrl+D Ctrl+F Ctrl+B 85
1. vi vi 2. <a> <i> 3. 4. <Esc> 5. :w file, 6. vi :q, 86
shell
88
Shell 89
(meta-data) * [ ] [ - ] 90
0 STDIN 1 STDOUT 2 STDERR 91
command < filename command > filename command 2> filename 92
$cmd1 cmd2 ls lpr #ls lpr 93
shell <Tab> #pass<tab> // passwd 94
Shell shell shell 95
set var=sting unset var echo $ 96
set int=5 set var1=abcd set var2=var1$efgh var2 abcdefgh var2 echo $var2 abcdefgh 97
nohup jobs 99
Linux PID 100
101
PID(Process ID) PPID(Parent Process ID) 201 1 206 201 207 206 102
$echo $$ 201 $bash SHELL $echo $$ 206 $date tue sept 5 11:18:26 gmt 1995 $<ctrl-d> SHELL $echo $$ 201 103
ps report process status ps [ ] -a tty -f -r -u -x 104
ps $ps -f UID PID PPID TTY COMMAND john 201 1 1 -ksh john 206 201 1 ksh john 209 206 1 ls-l TTY : 105
ctrl-c kill kill 106
$ps -f UID PID PPID TTY COMMAND john 206 201 1 ksh john 209 206 1 ls -R $kill 209 $kill 9 209 107
nohup no hang-up $nohup ls -R l > out & $nohup ls -R l & & bg background fg foreground ctrl-z 108
Linux
date #date Thu Jan 27 05:34:40 CST 2000 110
time $time [options] command [arguments] $time ls $time ls -R 111
cal calendar #cal 2 1995 February 1995 Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 112
clear clear the screen ctrl-l #clear 113
echo echo [-n] STRING -n #echo This is a command. This is a command. #echo This is a command This is a command. #echo -n Enter data-> Enter data->#_ 114
grep grep [ ] [ ][ 1 2 ].txt hello #grep hello *.txt file1 ramble.*b #grep ramble\.\*b file1 115
wc word count #wc [-c] [-l] [-w] filename -c -l -w $wc myfile 17 126 1085 myfile lines words 116
bc $bc $bc -l 117
su switch user $su [option] username 118
ping #ping 10.99.241.204 PING 10.99.19.44 (10.99.19.44) from 10.99.19.44 : 56(84) bytes of data. 64 bytes from 10.99.19.44: icmp_seq=1 ttl=255 time=0.092 ms 64 bytes from 10.99.19.44: icmp_seq=2 ttl=255 time=0.022 ms 64 bytes from 10.99.19.44: icmp_seq=3 ttl=255 time=0.020 ms 64 bytes from 10.99.19.44: icmp_seq=4 ttl=255 time=0.019 ms 120
who #who notes lft0 Jan 23 09:18 notes pts/0 Jan 24 01:19 (:0.0) root pts/1 Jan 27 05:34 (128.0.0.71) #who am i (whoami) root pts/1 Jan 27 05:34 (128.0.0.71) 121
finger shell #finger root Login name: root Directory: / Shell: /bin/ksh On since Jan 27 05:34:17 on pts/1, 14 seconds Idle Time from 128.0.0.71 No Plan. 122
manual man man info man (man1-man9) #man ls [ ] NAME SYNOPSIS DESCRIPTION OPTION 123
--help --help $ls --help 124
Questions & Answer