香港六合天下彩:

- “ϵԒ - - У· - VӅ^ɽ·A@^3307(AT)
Fڵλã ӋCӖ >> Ӗ̳ >> Linux̳ >> 
һЩlinuxϵyʹԔ ߣ    ̳́Դվԭ    c    •rg2011-12-16

ϴȫ www.wzfng.com һЩlinuxϵyʹ÷Ԕ⣺

        1Qcat

ʹÙޣʹ

ʹ÷ʽcat [-AbeEnstTuv] [--help] [--version] fileName

fљnBӺݔ(ΞĻ > fileName һn)

-n --number 1 _ʼݔД̖

-b --number-nonblank -n ֻ^ڿհв̖

-s --squeeze-blank BmϵĿհʹQһеĿհ

-v --show-nonprinting

cat -n textfile1 > textfile2 textfile1 ęnݼ̖ݔ textfile2 @n

cat -b textfile1 textfile2 >> textfile3 textfile1 textfile2 ęnݼ̖(հв)֮󌢃ݸӵ textfile3

2Q : cd

ʹÙ : ʹ

ʹ÷ʽ : cd [dirName]

f : ׃QĿ dirName dirName ʾɞ^··ĿQʡt׃Qʹߵ home directory (ҲDŽ login rڵĿ)

"~" Ҳʾ home directory ˼"." tDZʾĿǰڵĿ".." tʾĿǰĿλõһĿ

: /usr/bin/ :

cd /usr/bin

Լ home directory :

cd ~

ĿǰĿ䛵σɌ :

cd ../..

3ָQ : chmod

ʹÙ : ʹ

ʹ÷ʽ : chmod [-cfvR] [--help] [--version] mode file...

f : Linux/Unix ęnȡ޷֞ : nȺM chmod ԽԿƙnαȡ

Ӌ :

mode : Oִʽ : [ugoa...][[+-=][rwxX]...][,...]u ʾԓnēg ʾcԓnēߌͬһȺw(group)o ʾa ʾ@߽

+ ʾә- ʾȡ= ʾΨһO

r ʾxȡw ʾɌx ʾɈX ʾֻЮԓnǂĿ䛻ԓnѽO^Ɉ

-c : ԓn޴_ѽ@ʾĄ

-f : ԓnޟoҲҪ@ʾe`ӍϢ

-v : @ʾ׃ԔY

-R : ĿǰĿµЙncĿMͬę׃(fصķʽ׃)

--help : @ʾof

--version : @ʾ汾

:n file1.txt O˽Կxȡ :

chmod ugo+r file1.txt

n file1.txt O˽Կxȡ :

chmod a+r file1.txt

n file1.txt c file2.txt OԓncͬһȺw߿Ɍ˄tɌ :

chmod ug+w,o-w file1.txt file2.txt

ex1.py Oֻԓn߿Ԉ :

chmod u+x ex1.py

ĿǰĿµЙncĿ䛽Oκ˿xȡ :

chmod -R a+r *

chmodҲÔցʾ chmod 777 file

Z飺chmod abc file

a,b,cһքeʾUserGroupOtherę

r=4w=2x=1

ҪrwxԄt4+2+1=7;

Ҫrw-Ԅt4+2=6;

Ҫr-xԄt4+1=7

chmod a=rwx filechmod 777 fileЧͬ

chmod ug=rwx,o=x filechmod 771 fileЧͬ

chmod 4755 filenameʹ˳ʽrootę

4ָQ : chown

ʹÙ : root

ʹ÷ʽ : chmod [-cfhvR] [--help] [--version] user[:group] file...

f : Linux/Unix Ƕ˶๤IϵyеęnГ chown Ԍnē߼Ը׃һf@ָֻϵy(root)ʹһʹߛ]Й޿Ը׃e˵ęnҲ]Й޿Լęn߸Oeֻϵy(root)@ӵę

Ӌ :

user : µęnߵʹ IDgroup : µęnߵʹȺw(group)-c : ԓnߴ_ѽ@ʾĄ-f : ԓnߟoҲҪ@ʾe`ӍϢ-h : ֻBY(link)M׃ԓ link ָęn-v : @ʾ׃ԔY-R : ĿǰĿµЙncĿMͬē׃(fصķʽ׃)--help : @ʾof--version : @ʾ汾

:

n file1.txt ēO users Ⱥwʹ jessie :

chown jessie:users file1.txt

ĿǰĿµЙncĿ䛵ē߽O users Ⱥwʹ lamport :

chmod -R lamport:users *

5Qcp

ʹÙޣʹ

ʹ÷ʽ

cp [options] source dest

cp [options] source... directory

fһnؐһn򌢔nؐһĿ

Ӌ

-a M܌nB޵Y϶ԭԏ

-r source кĿtĿ֮nؐĿĵ

-f ĿĵѽͬnęntڏǰԄhЏ

n aaa (Ѵ) bbb :

cp aaa bbb

еCZԳʽؐ Finished Ŀ :

cp *.c Finished

6Qcut

ʹÙޣʹ

÷cut -cnum1-num2 filename

f@ʾÿЏ_^ num1 num2 

shell>> cat example

test2

this is test1

shell>> cut -c0-6 example ## print _^ǰ 6 Ԫ

test2

this i

Q : find

÷ : find

ʹf :

nϵyȷ expression ęnгָҪnQergС޵ȲͬYӍĽMֻȫIJŕг

find ҎtД path expressionϵһ - ( ) , ! ֮ǰIJݞ path֮ expression path ǿִtʹĿǰ· expression ǿִtʹ -print AO expression

expression пʹõxжʮ֮ڴֻBõIJ

-mount, -xdev : ֻzָĿͬһnϵyµęnгnϵyеęn

-amin n : ^ȥ n 犃ȱxȡ^

-anewer file : șn file xȡ^ęn

-atime n : ^ȥ n ^xȡ^ęn

-cmin n : ^ȥ n 犃ȱ޸^

-cnewer file :șn file µęn

-ctime n : ^ȥ n ^޸^ęn

-empty : յęn-gid n or -group name : gid n group Q name

-ipath p, -path p : ·Q p ęnipath ԴС

-name name, -iname name : nQ name ęniname ԴС

-size n : nС n λb 512 λԪMą^Kc ʾԪk ʾ kilo bytesw ǶλԪM-type c : n c ęn

d: Ŀ

c: bÙn

b: ^KbÙn

p: A

f: һn

l: ̖BY

s: socket

-pid n : process id n ęn

ʹ ( ) \ʽָʹ\

exp1 -and exp2

! expr

-not expr

exp1 -or exp2

exp1, exp2

:

ĿǰĿ䛼Ŀn c ęnг

# find . -name "*.c"

ĿǰĿĿһnг

# find . -ftype f

ĿǰĿ䛼Ŀ 20 犃ȸ^ęnг

# find . -ctime -20

VӋCWУ

WУ· |Wվ؈D| ϴȫ Copyright 2006-2016 All Rights Reserved VϢԃ޹˾ 䰸/SC̖ICP11070650̖-9 B̩˱BϢg޹˾VӋCWУӖW ٷWַϴȫ www.wzfng.com ˾ַVӅ^ɽ·AWƼ@A@^3307AT