·þÎñÆ÷ϵͳ¼¯³É¼°Êý¾Ý·þÎñÖÐÐÄ

 

Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
Ò»¼¶À¸Ä¿
¡¾æŠ€æœ¯èµ„æ–?uppage=news.asp¡¿¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­¡­>>>

Linux³£ÓÃÃüÁî

linux³£ÓÃÃüÁÏê½â£©

Ò»¡¢ÈÕ³£Ê¹ÓÃÃüÁî/³£Óÿì½Ý¼üÃüÁî
¿ª¹Ø»úÃüÁî
        1¡¢shutdown ¨Ch now£ºÁ¢¿Ì½øÐйػú

        2¡¢shutdown ¨Cr now£ºÏÖÔÚÖØÐÂÆô¶¯¼ÆËã»ú

        3¡¢reboot£ºÏÖÔÚÖØÐÂÆô¶¯¼ÆËã»ú

        4¡¢su -£ºÇл»Óû§£»passwd£ºÐÞ¸ÄÓû§ÃÜÂë

        5¡¢logout£ºÓû§×¢Ïú

³£Óÿì½ÝÃüÁî
        1¡¢tab = ²¹È«

        2¡¢ctrl + l -£ºÇåÆÁ£¬ÀàËÆclearÃüÁî

        3¡¢ctrl + r -£º²éÕÒÀúÊ·ÃüÁhistory£©£»ctrl+c = ÖÕÖ¹

        4¡¢ctrl+k = ɾ³ý´Ë´¦ÖÁĩβËùÓÐÄÚÈÝ

        5¡¢ctrl+u = ɾ³ý´Ë´¦ÖÁ¿ªÊ¼ËùÓÐÄÚÈÝ

³£Óù¤¾ßÃüÁî
man:°ïÖúÃüÁî
    wc:Îı¾Í³¼Æͳ¼Æ
        wordcount
         3      5         29         a.txt
         ÐÐÊý    µ¥´ÊÊý    ×Ö·ûÊý    ÎļþÃû
        ³£¼û²ÎÊý£º
            -l£ºÖ»²é¿´ÐÐÊý
            -w: Ö»²é¿´µ¥´ÊÊý
            -c£ºÖ»²é¿´×Ö·ûÊý
    du:Îļþ´óСͳ¼Æ
        ¸ñʽ£ºdu [Ñ¡Ïî²ÎÊý] dir_path
        ³£¼û²ÎÊý£º
                -s:ֻͳ¼Æ¸ÃÎļþĿ¼µÄ´óС£¬²»µÝ¹é
                -h:ÈËÐÔ»¯µÄÏÔʾµ¥Î»
    find:Îļþ¼ìË÷ÃüÁî
Óï·¨
 
find   path   -option   [   -print ]   [ -exec   -ok   command ]   {} \
 
²ÎÊý˵Ã÷ :
 
find ¸ù¾ÝÏÂÁйæÔòÅÐ¶Ï path ºÍ expression£¬ÔÚÃüÁîÁÐÉϵÚÒ»¸ö - ( ) , ! ֮ǰµÄ²¿·ÝΪ path£¬Ö®ºóµÄÊÇ expression¡£Èç¹û path ÊÇ¿Õ×Ö´®ÔòʹÓÃĿǰ·¾¶£¬Èç¹û expression ÊÇ¿Õ×Ö´®ÔòʹÓà -print ΪԤÉè expression¡£
 
expression ÖпÉʹÓõÄÑ¡ÏîÓжþÈýÊ®¸öÖ®¶à£¬ÔÚ´ËÖ»½éÉÜ×î³£ÓõIJ¿·Ý¡£
 
-mount, -xdev : Ö»¼ì²éºÍÖ¸¶¨Ä¿Â¼ÔÚͬһ¸öÎļþϵͳϵÄÎļþ£¬±ÜÃâÁгöÆäËüÎļþϵͳÖеÄÎļþ
 
-amin n : ÔÚ¹ýÈ¥ n ·ÖÖÓÄÚ±»¶ÁÈ¡¹ý
 
-anewer file : ±ÈÎļþ file ¸üÍí±»¶ÁÈ¡¹ýµÄÎļþ
 
-atime n : ÔÚ¹ýÈ¥nÌìÄÚ±»¶ÁÈ¡¹ýµÄÎļþ
 
-cmin n : ÔÚ¹ýÈ¥ n ·ÖÖÓÄÚ±»Ð޸Ĺý
 
-cnewer file :±ÈÎļþ file ¸üеÄÎļþ
 
-ctime n : ÔÚ¹ýÈ¥nÌìÄÚ±»Ð޸ĹýµÄÎļþ
 
-empty : ¿ÕµÄÎļþ-gid n or -group name : gid ÊÇ n »òÊÇ group Ãû³ÆÊÇ name
 
-ipath p, -path p : ·¾¶Ãû³Æ·ûºÏ p µÄÎļþ£¬ipath »áºöÂÔ´óСд
 
-name name, -iname name : ÎļþÃû³Æ·ûºÏ name µÄÎļþ¡£iname »áºöÂÔ´óСд
 
-size n : Îļþ´óС ÊÇ n µ¥Î»£¬b ´ú±í 512 λԪ×éµÄÇø¿é£¬c ±íʾ×ÖÔªÊý£¬k ±íʾ kilo bytes£¬w ÊǶþ¸öλԪ×é¡£-type c : ÎļþÀàÐÍÊÇ c µÄÎļþ¡£
 
d: Ŀ¼
 
c: ×ÖÐÍ×°ÖÃÎļþ
 
b: Çø¿é×°ÖÃÎļþ
 
p: ¾ßÃûÖüÁÐ
 
f: Ò»°ãÎļþ
 
l: ·ûºÅÁ¬½á
 
s: socket
 
-pid n : process id ÊÇ n µÄÎļþ
 
Äã¿ÉÒÔʹÓà ( ) ½«ÔËËãʽ·Ö¸ô£¬²¢Ê¹ÓÃÏÂÁÐÔËËã¡£
 
exp1 -and exp2
 
! expr
 
-not expr
 
exp1 -or exp2
 
exp1, exp2
ʵÀý
 
½«Ä¿Ç°Ä¿Â¼¼°Æä×ÓĿ¼ÏÂËùÓÐÑÓÉìµµÃûÊÇ c µÄÎļþÁгöÀ´¡£
 
# find . -name "*.c"
 
½«Ä¿Ç°Ä¿Â¼ÆäÆäÏÂ×ÓĿ¼ÖÐËùÓÐÒ»°ãÎļþÁгö
 
# find . -type f
 
½«Ä¿Ç°Ä¿Â¼¼°Æä×ÓĿ¼ÏÂËùÓÐ×î½ü 20 ÌìÄÚ¸üйýµÄÎļþÁгö
 
# find . -ctime -20
 
²éÕÒ/var/logĿ¼Öиü¸Äʱ¼äÔÚ7ÈÕÒÔÇ°µÄÆÕͨÎļþ£¬²¢ÔÚɾ³ý֮ǰѯÎÊËüÃÇ£º
 
# find /var/log -type f -mtime +7 -ok rm {} \
 
²éÕÒǰĿ¼ÖÐÎļþÊôÖ÷¾ßÓжÁ¡¢Ð´È¨ÏÞ£¬²¢ÇÒÎļþËùÊô×éµÄÓû§ºÍÆäËûÓû§¾ßÓжÁȨÏÞµÄÎļþ£º
 
# find . -type f -perm 644 -exec ls -l {} \
 
ΪÁ˲éÕÒϵͳÖÐËùÓÐÎļþ³¤¶ÈΪ0µÄÆÕͨÎļþ£¬²¢ÁгöËüÃǵÄÍêÕû·¾¶£º
 
# find / -type f -size 0 -exec ls -l {} \


¶þ¡¢³£ÓÃĿ¼/Îļþ²Ù×÷ÃüÁî
1.չʾĿ¼ÁбíÃüÁîls£¨list£©
  ls             չʾµ±Ç°Ä¿Â¼ÏµĿɼûÎļþ
  ls -a         չʾµ±Ç°Ä¿Â¼ÏÂËùÓеÄÎļþ£¨°üÀ¨Òþ²ØµÄÎļþ£©
  ls -l(ll)      չʾµ±Ç°Ä¿Â¼ÏÂÎļþµÄÏêϸÐÅÏ¢
  ll -a          չʾµ±Ç°Ä¿Â¼ÏÂËùÓÐÎļþµÄÏêϸÐÅÏ¢
  ll -h          ÓѺõÄÏÔʾµ±Ç°Ä¿Â¼ÏÂÎļþµÄÏêϸÐÅÏ¢£¨Æäʵ¾ÍÊÇÎļþµÄ´óС¿É¶ÁÐÔ¸üÇ¿ÁË£©

  pwd£ºÏÔʾĿǰµÄĿ¼

2.Çл»Ä¿Â¼ÃüÁîcd£¨change directory£©
  cd test         Çл»µ½testĿ¼ÏÂ
  cd .. Çл»µ½ÉÏÒ»¼¶Ä¿Â¼
  cd / Çл»µ½ÏµÍ³¸ùĿ¼ÏÂ
  cd ~ Çл»µ½µ±Ç°Óû§µÄ¸ùĿ¼ÏÂ
  cd - Çл»µ½ÉÏÒ»¼¶ËùÔÚµÄĿ¼

3.Ŀ¼µÄ´´½¨£¨mkdir£©ºÍɾ³ý£¨rmdir£©ÃüÁî
  mkdir test ÔÚµ±Ç°Ä¿Â¼Ï´´½¨Ò»¸ötestĿ¼
  mkdir -p test/a/b ÔÚtestĿ¼ÏµÄaĿ¼Ï´´½¨Ò»¸öbĿ¼£¬Èç¹ûÉÏÒ»¼¶Ä¿Â¼²»´æÔÚ£¬ÔòÁ¬ËüµÄ¸¸Ä¿Â¼Ò»Æð´´½¨
  rmdir test ɾ³ýµ±Ç°Ä¿Â¼ÏµÄtestĿ¼£¨×¢Ò⣺¸ÃÃüÁîÖ»Äܹ»É¾³ý¿ÕĿ¼£©

4.ÎļþµÄ´´½¨£¨touch£©ºÍɾ³ý£¨rm£©ÃüÁî
  touch test.txt         ÔÚµ±Ç°Ä¿Â¼Ï´´½¨Ò»¸ötest.txtµÄÎļþ
  rm test.txt ɾ³ýtest.txtµÄÎļþ£¨´øѯÎʵÄɾ³ý£¬ÐèÊäÈëy²ÅÄÜɾ³ý£©
  rm -f test.txt Ö±½Óɾ³ýtext.txtÎļþ
  rm -r test µÝ¹éɾ³ý£¬¼´É¾³ýtestĿ¼ÒÔ¼°ÆäĿ¼ÏµÄ×ÓĿ¼£¨´øѯÎʵÄɾ³ý£©
  rm -rf test Ö±½Óɾ³ýtestĿ¼ÒÔ¼°ÆäĿ¼ÏµÄ×ÓĿ¼

5.Îļþ´ò°ü»ò½âѹÃüÁîtar
´ò°ü²¢Ñ¹ËõÎļþ
LinuxÖеĴò°üÎļþÒ»°ãÊÇÒÔ.tar½áβµÄ£¬Ñ¹ËõµÄÃüÁîÒ»°ãÊÇÒÔ.gz½áβµÄ¡£
¶øÒ»°ãÇé¿öÏ´ò°üºÍѹËõÊÇÒ»Æð½øÐеģ¬´ò°ü²¢Ñ¹ËõºóµÄÎļþµÄºó׺ÃûÒ»°ã.tar.gz¡£
ÃüÁtar -zcvf ´ò°üѹËõºóµÄÎļþÃû Òª´ò°üѹËõµÄÎļþ
ÆäÖУºz£ºµ÷ÓÃgzipѹËõÃüÁî½øÐÐѹËõ
  c£º´ò°üÎļþ
  v£ºÏÔʾÔËÐйý³Ì
  f£ºÖ¸¶¨ÎļþÃû
ʾÀý£º´ò°ü²¢Ñ¹Ëõ/testϵÄËùÓÐÎļþ ѹËõºóµÄѹËõ°üÖ¸¶¨Ãû³ÆΪxxx.tar.gz
tar -zcvf xxx.tar.gz aaa.txt bbb.txt ccc.txt
»ò£ºtar -zcvf xxx.tar.gz /test/*

½âѹѹËõ°ü£¨Öص㣩
ÃüÁtar [-xvf] ѹËõÎļþ
ÆäÖУºx£º´ú±í½âѹ
ʾÀý£º½«/testϵÄxxx.tar.gz½âѹµ½µ±Ç°Ä¿Â¼ÏÂ
tar -xvf xxx.tar.gz
ʾÀý£º½«/testϵÄxxx.tar.gz½âѹµ½¸ùĿ¼/usrÏÂ
tar -xvf xxx.tar.gz -C /usrC´ú±íÖ¸¶¨½âѹµÄλÖÃ


LinuxµÄȨÏÞÃüÁî
ȨÏÞÊÇLinuxÖеÄÖØÒª¸ÅÄÿ¸öÎļþ/Ŀ¼µÈ¶¼¾ßÓÐȨÏÞ£¬Í¨¹ýls -lÃüÁîÎÒÃÇ¿ÉÒÔ ²é¿´Ä³¸öĿ¼ÏµÄÎļþ»òĿ¼µÄȨÏÞ

ÎļþµÄÀàÐÍ£º
d£º´ú±íĿ¼
-£º´ú±íÎļþ
l£º´ú±íÁ´½Ó£¨¿ÉÒÔÈÏΪÊÇwindowÖеĿì½Ý·½Ê½£©
ºóÃæµÄ9λ·ÖΪ3×飬ÿ3λÖÃÒ»×飬·Ö±ð´ú±íÊôÖ÷µÄȨÏÞ£¬Ó뵱ǰÓû§Í¬×éµÄ     Óû§µÄȨÏÞ£¬ÆäËûÓû§µÄȨÏÞ
r£º´ú±íȨÏÞÊǿɶÁ£¬rÒ²¿ÉÒÔÓÃÊý×Ö4±íʾ
w£º´ú±íȨÏÞÊÇ¿Éд£¬wÒ²¿ÉÒÔÓÃÊý×Ö2±íʾ
x£º´ú±íȨÏÞÊÇ¿ÉÖ´ÐУ¬xÒ²¿ÉÒÔÓÃÊý×Ö1±íʾ

ÊôÖ÷£¨user£©¡¡Êô×飨group£©¡¡ÆäËûÓû§
r¡¡w¡¡x¡¡¡¡¡¡r¡¡w¡¡x ¡¡¡¡r¡¡w¡¡x
4¡¡2¡¡1¡¡¡¡¡¡4¡¡2¡¡1¡¡¡¡¡¡¡¡  4¡¡2¡¡1

linuxÖÐÓû§µÄ·ÖÀà
        СÀî     СÀî¶ÔÏó    ÀÏÍõ
        ËùÓÐÕßu    ͬ×éÓû§g    ÆäËûÈËo
    linuxÖÐÎļþȨÏÞ
        ¶Ár        дw        Ö´ÐÐx    ûÓÐȨÏÞ-
       
    ÎļþÏêÇéÐÅÏ¢£º
        -rw-rr. 1 root root       5 Aug 28 02:27 a.txt   
        d rwx r-x r-x. 2 root root    4096 Aug 27 08:52 test
        µÚһλ£ºd:Ŀ¼£¬-£ºÎļþ
        rw-                r                r
        ËùÓÐÕß           ͬ×éÓû§        ÆäËûÈË
        Ö»ÓжÁд          Ö»ÓжÁ            Ö»ÓжÁ
       
    1£º¸ÃÎļþµÄÁ´½ÓÊý
    root£ºÎļþËùÊôÕß
    root£ºÎļþËùÊô×é
     5 Aug 28 02:27£º×îºóµÄÐÞ¸Äʱ¼ä

ÐÞ¸ÄÎļþ/Ŀ¼µÄȨÏÞµÄÃüÁchmod
ʾÀý£ºÐÞ¸Ä/testϵÄaaa.txtµÄȨÏÞΪÊôÖ÷ÓÐÈ«²¿È¨ÏÞ£¬ÊôÖ÷ËùÔÚµÄ×éÓжÁдȨÏÞ£¬
ÆäËûÓû§Ö»ÓжÁµÄȨÏÞ
chmod u=rwx,g=rw,o=r aaa.txt

ÉÏÊöʾÀý»¹¿ÉÒÔʹÓÃÊý×Ö±íʾ£º
chmod 764 aaa.txt

ÐÞ¸ÄÎļþµÄËùÊôÓû§ºÍËùÊô×é chown
        chown username:groupName aa.txt
        chown username: aa.txt
        chown :groupName aa.txt
   
        -R£ºµÝ¹é×ÓĿ¼ÐÞ¸ÄËùÊôÕߺÍËùÊô×é

Èý¡¢Îļþ/Îļþ¼ÐµÄcp rm¼°ÎļþµÄ²é¿´
cp (¸´ÖÆÎļþ»òĿ¼)
cp ¼´¿½±´ÎļþºÍĿ¼¡£

Óï·¨:

[root@www ~]# cp [-adfilprsu] À´Ô´µµ(source) Ä¿±êµµ(destination)
[root@www ~]# cp [options] source1 source2 source3 .... directory
Ñ¡ÏîÓë²ÎÊý£º

-a£ºÏàµ±ì¶ -pdr µÄÒâ˼£¬ÖÁì¶ pdr Çë²Î¿¼ÏÂÁÐ˵Ã÷£»(³£ÓÃ)

-d£ºÈôÀ´Ô´µµÎªÁ¬½áµµµÄÊôÐÔ(link file)£¬Ôò¸´ÖÆÁ¬½áµµÊôÐÔ¶ø·ÇÎļþ±¾Éí£»

-f£ºÎªÇ¿ÖÆ(force)µÄÒâ˼£¬ÈôÄ¿±êÎļþÒѾ­´æÔÚÇÒÎÞ·¨¿ªÆô£¬ÔòÒƳýºóÔÙ³¢ÊÔÒ»´Î£»

-i£ºÈôÄ¿±êµµ(destination)ÒѾ­´æÔÚʱ£¬ÔÚ¸²¸Çʱ»áÏÈѯÎʶ¯×÷µÄ½øÐÐ(³£ÓÃ)

-l£º½øÐÐӲʽÁ¬½á(hard link)µÄÁ¬½áµµ´´½¨£¬¶ø·Ç¸´ÖÆÎļþ±¾Éí£»

-p£ºÁ¬Í¬ÎļþµÄÊôÐÔÒ»Æð¸´ÖƹýÈ¥£¬¶ø·ÇʹÓÃĬÈÏÊôÐÔ(±¸·Ý³£ÓÃ)£»

-r£ºµÝ¹é³ÖÐø¸´ÖÆ£¬ÓÃì¶Ä¿Â¼µÄ¸´ÖÆÐÐΪ£»(³£ÓÃ)

-s£º¸´ÖƳÉΪ·ûºÅÁ¬½áµµ (symbolic link)£¬Ò༴¡º½Ý¾¶¡»Îļþ£»

-u£ºÈô destination ±È source ¾É²ÅÉý¼¶ destination £¡

Óà root Éí·Ý£¬½« root Ŀ¼Ï嵀 .bashrc ¸´ÖƵ½ /tmp Ï£¬²¢ÃüÃûΪ bashrc

[root@www ~]# cp ~/.bashrc /tmp/bashrc
[root@www ~]# cp -i ~/.bashrc /tmp/bashrc
cp: overwrite `/tmp/bashrc''? n  <==n²»¸²¸Ç£¬yΪ¸²¸Ç
rm (ÒƳýÎļþ»òĿ¼)
Óï·¨£º

 rm [-fir] Îļþ»òĿ¼
Ñ¡ÏîÓë²ÎÊý£º

-f £º¾ÍÊÇ force µÄÒâ˼£¬ºöÂÔ²»´æÔÚµÄÎļþ£¬²»»á³öÏÖ¾¯¸æÐÅÏ¢£»
-i £º»¥¶¯Ä£Ê½£¬ÔÚɾ³ýÇ°»áѯÎÊʹÓÃÕßÊÇ·ñ¶¯×÷
-r £ºµÝ¹éɾ³ý°¡£¡×î³£ÓÃÔÚĿ¼µÄɾ³ýÁË£¡ÕâÊǷdz£Î£ÏÕµÄÑ¡Ï£¡£¡
 
½«¸Õ¸ÕÔÚ cp µÄʵÀýÖд´½¨µÄ bashrc ɾ³ýµô£¡

[root@www tmp]# rm -i bashrc
rm: remove regular file `bashrc''? y
Èç¹û¼ÓÉÏ -i µÄÑ¡Ïî¾Í»áÖ÷¶¯Ñ¯ÎÊร¬±ÜÃâÄãɾ³ýµ½´íÎóµÄµµÃû£¡

mv (Òƶ¯ÎļþÓëĿ¼£¬»òÐÞ¸ÄÃû³Æ)
Óï·¨£º

[root@www ~]# mv [-fiu] source destination
[root@www ~]# mv [options] source1 source2 source3 .... directory
Ñ¡ÏîÓë²ÎÊý£º

-f £ºforce Ç¿ÖƵÄÒâ˼£¬Èç¹ûÄ¿±êÎļþÒѾ­´æÔÚ£¬²»»áѯÎʶøÖ±½Ó¸²¸Ç£»
-i £ºÈôÄ¿±êÎļþ (destination) ÒѾ­´æÔÚʱ£¬¾Í»áѯÎÊÊÇ·ñ¸²¸Ç£¡
-u £ºÈôÄ¿±êÎļþÒѾ­´æÔÚ£¬ÇÒ source ±È½ÏУ¬²Å»áÉý¼¶ (update)
¸´ÖÆÒ»Îļþ£¬´´½¨Ò»Ä¿Â¼£¬½«ÎļþÒƶ¯µ½Ä¿Â¼ÖÐ

[root@www ~]# cd /tmp
[root@www tmp]# cp ~/.bashrc bashrc
[root@www tmp]# mkdir mvtest
[root@www tmp]# mv bashrc mvtest
½«Ä³¸öÎļþÒƶ¯µ½Ä³¸öĿ¼ȥ£¬¾ÍÊÇÕâÑù×ö£¡

½«¸Õ¸ÕµÄĿ¼Ãû³Æ¸üÃûΪ mvtest2

[root@www tmp]# mv mvtest mvtest2
Linux ÎļþÄÚÈݲ鿴
LinuxϵͳÖÐʹÓÃÒÔÏÂÃüÁîÀ´²é¿´ÎļþµÄÄÚÈÝ£º

cat  ÓɵÚÒ»ÐпªÊ¼ÏÔʾÎļþÄÚÈÝ
tac  ´Ó×îºóÒ»ÐпªÊ¼ÏÔʾ£¬¿ÉÒÔ¿´³ö tac ÊÇ cat µÄµ¹Öøд£¡
nl   ÏÔʾµÄʱºò£¬Ë³µÀÊä³öÐкţ¡
more Ò»Ò³Ò»Ò³µÄÏÔʾÎļþÄÚÈÝ
less Óë more ÀàËÆ£¬µ«ÊÇ±È more ¸üºÃµÄÊÇ£¬Ëû¿ÉÒÔÍùÇ°·­Ò³£¡
head Ö»¿´Í·¼¸ÐÐ
tail Ö»¿´Î²°Í¼¸ÐÐ
Äã¿ÉÒÔʹÓà man [ÃüÁî]À´²é¿´¸÷¸öÃüÁîµÄʹÓÃÎĵµ£¬Èç £ºman cp¡£

cat
ÓɵÚÒ»ÐпªÊ¼ÏÔʾÎļþÄÚÈÝ

Óï·¨£º

cat [-AbEnTv]
Ñ¡ÏîÓë²ÎÊý£º

-A £ºÏàµ±ì¶ -vET µÄÕûºÏÑ¡Ï¿ÉÁгöһЩÌØÊâ×Ö·û¶ø²»Êǿհ׶øÒÑ£»
-b £ºÁгöÐкţ¬½öÕë¶Ô·Ç¿Õ°×ÐÐ×öÐкÅÏÔʾ£¬¿Õ°×Ðв»±êÐкţ¡
-E £º½«½áβµÄ¶ÏÐÐ×Ö½Ú $ ÏÔʾ³öÀ´£»
-n £ºÁÐÓ¡³öÐкţ¬Á¬Í¬¿Õ°×ÐÐÒ²»áÓÐÐкţ¬Óë -b µÄÑ¡Ïͬ£»
-T £º½« [tab] °´¼üÒÔ ^I ÏÔʾ³öÀ´£»
-v £ºÁгöһЩ¿´²»³öÀ´µÄÌØÊâ×Ö·û
¼ì¿´ /etc/issue Õâ¸öÎļþµÄÄÚÈÝ£º

[root@www ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
tac
tacÓëcatÃüÁî¸ÕºÃÏà·´£¬ÎļþÄÚÈÝ´Ó×îºóÒ»ÐпªÊ¼ÏÔʾ£¬¿ÉÒÔ¿´³ö tac ÊÇ cat µÄµ¹×Åд£¡È磺

[root@www ~]# tac /etc/issue

Kernel \r on an \m
CentOS release 6.4 (Final)
nl
ÏÔʾÐкÅ

Óï·¨£º

nl [-bnw] Îļþ
Ñ¡ÏîÓë²ÎÊý£º

-b £ºÖ¸¶¨ÐкÅÖ¸¶¨µÄ·½Ê½£¬Ö÷ÒªÓÐÁ½ÖÖ£º
-b a £º±íʾ²»ÂÛÊÇ·ñΪ¿ÕÐУ¬Ò²Í¬ÑùÁгöÐкÅ(ÀàËÆ cat -n)£»
-b t £ºÈç¹ûÓпÕÐУ¬¿ÕµÄÄÇÒ»Ðв»ÒªÁгöÐкÅ(ĬÈÏÖµ)£»
-n £ºÁгöÐкűíʾµÄ·½·¨£¬Ö÷ÒªÓÐÈýÖÖ£º
-n ln £ºÐкÅÔÚÓ«Ä»µÄ×î×ó·½ÏÔʾ£»
-n rn £ºÐкÅÔÚ×Ô¼ºÀ¸Î»µÄ×îÓÒ·½ÏÔʾ£¬ÇÒ²»¼Ó 0 £»
-n rz £ºÐкÅÔÚ×Ô¼ºÀ¸Î»µÄ×îÓÒ·½ÏÔʾ£¬ÇÒ¼Ó 0 £»
-w £ºÐкÅÀ¸Î»µÄÕ¼ÓõÄλÊý¡£
ʵÀýÒ»£ºÓà nl Áгö /etc/issue µÄÄÚÈÝ

[root@www ~]# nl /etc/issue
     1  CentOS release 6.4 (Final)
     2  Kernel \r on an \m
more
Ò»Ò³Ò»Ò³·­¶¯

[root@www ~]# more /etc/man.config
#
# Generated automatically from man.conf.in by the
# configure script.
#
# man.conf from man-1.6d
....(ÖмäÊ¡ÂÔ)....
More(28%)  <== ÖصãÔÚÕâÒ»ÐÐร¡ÄãµÄ¹â±êÒ²»áÔÚÕâÀïµÈ´ýÄãµÄÃüÁî
ÔÚ more Õâ¸ö³ÌÐòµÄÔËÐйý³ÌÖУ¬ÄãÓм¸¸ö°´¼ü¿ÉÒÔ°´µÄ£º

¿Õ°×¼ü (space)£º´ú±íÏòÏ·­Ò»Ò³£»
Enter         £º´ú±íÏòÏ·­¡ºÒ»ÐС»£»
/×Ö´®         £º´ú±íÔÚÕâ¸öÏÔʾµÄÄÚÈݵ±ÖУ¬ÏòÏÂËÑÑ°¡º×Ö´®¡»Õâ¸ö¹Ø¼ü×Ö£»
:f            £ºÁ¢¿ÌÏÔʾ³öµµÃûÒÔ¼°Ä¿Ç°ÏÔʾµÄÐÐÊý£»
q             £º´ú±íÁ¢¿ÌÀ뿪 more £¬²»ÔÙÏÔʾ¸ÃÎļþÄÚÈÝ¡£
b »ò [ctrl]-b £º´ú±íÍù»Ø·­Ò³£¬²»¹ýÕ⶯×÷Ö»¶ÔÎļþÓÐÓ㬶ԹÜÏßÎÞÓá£
less
Ò»Ò³Ò»Ò³·­¶¯£¬ÒÔÏÂʵÀýÊä³ö/etc/man.configÎļþµÄÄÚÈÝ£º

[root@www ~]# less /etc/man.config
#
# Generated automatically from man.conf.in by the
# configure script.
#
# man.conf from man-1.6d
....(ÖмäÊ¡ÂÔ)....
:   <== ÕâÀï¿ÉÒԵȴýÄãÊäÈëÃüÁ
lessÔËÐÐʱ¿ÉÒÔÊäÈëµÄÃüÁîÓУº

¿Õ°×¼ü    £ºÏòÏ·­¶¯Ò»Ò³£»
[pagedown]£ºÏòÏ·­¶¯Ò»Ò³£»
[pageup]  £ºÏòÉÏ·­¶¯Ò»Ò³£»
/×Ö´®     £ºÏòÏÂËÑÑ°¡º×Ö´®¡»µÄ¹¦ÄÜ£»
?×Ö´®     £ºÏòÉÏËÑÑ°¡º×Ö´®¡»µÄ¹¦ÄÜ£»
n         £ºÖظ´Ç°Ò»¸öËÑÑ° (Óë / »ò ? Óйأ¡)
N         £º·´ÏòµÄÖظ´Ç°Ò»¸öËÑÑ° (Óë / »ò ? Óйأ¡)
q         £ºÀ뿪 less Õâ¸ö³ÌÐò£»
head
È¡³öÎļþÇ°Ã漸ÐÐ

Óï·¨£º

head [-n number] Îļþ
Ñ¡ÏîÓë²ÎÊý£º

-n £ººóÃæ½ÓÊý×Ö£¬´ú±íÏÔʾ¼¸ÐеÄÒâ˼
[root@www ~]# head /etc/man.config
ĬÈϵÄÇé¿öÖУ¬ÏÔʾǰÃæ 10 ÐУ¡ÈôÒªÏÔʾǰ 20 ÐУ¬¾ÍµÃÒªÕâÑù£º

[root@www ~]# head -n 20 /etc/man.config
tail
È¡³öÎļþºóÃ漸ÐÐ

Óï·¨£º

tail [-n number] Îļþ
Ñ¡ÏîÓë²ÎÊý£º

-n £ººóÃæ½ÓÊý×Ö£¬´ú±íÏÔʾ¼¸ÐеÄÒâ˼
-f £º±íʾ³ÖÐøÕì²âºóÃæËù½ÓµÄµµÃû£¬ÒªµÈµ½°´ÏÂ[ctrl]-c²Å»á½áÊøtailµÄÕì²â
[root@www ~]# tail /etc/man.config
# ĬÈϵÄÇé¿öÖУ¬ÏÔʾ×îºóµÄÊ®ÐУ¡ÈôÒªÏÔʾ×îºóµÄ 20 ÐУ¬¾ÍµÃÒªÕâÑù£º
[root@www ~]# tail -n 20 /etc/man.config
ϵͳ³£ÓòÙ×÷ÃüÁî
visudo:±à¼­sudoÃüÁîµÄÅäÖÃ
        ±à¼­µÚ98ÐÐ
        ## Allow root to run any commands anywhere
            root    ALL=(ALL)                               ALL
            Óû§Ãû  µÇ¼µÄÖ÷»ú=£¨ÒÔʲôÑùµÄÉí·ÝÔËÐУ©  ¿ÉÒÔÖ´ÐÐʲôÃüÁî
        Èç¹ûÏëÈÃhuadianÓû§Ò²¾ÓÓÚrootÏà¹ØȨÏÞ¡£¡£
            huadian  ALL=(root)  NOPASSWD:service iptables status
            huadian  ALL=(root)  NOPASSWD:service iptables start
        ÍƼöÓ÷¨   
            huadian  ALL=(root)  NOPASSWD:ALL
           
        ʹÓÃȨÏÞ£ºsudo     service iptables status  £¨¼ì²é·À»ðǽ״̬£©
ÍøÂç¹ÜÀí£ºping¡¢ifconfig
    ·þÎñ¹ÜÀíÃüÁ
        service:±ØÐëÕÆÎÕ
            ¸ñʽ£º
                service s_name start|stop|status|restart
            linuxϵͳËùÓÐ×Ô´ø·þÎñÃû³Æ£º/etc/init.d/
                ³£Óãº
                    ¹Ø±Õ·À»ðǽ·þÎñ
                    service iptables stop
                    ÖØÆôÍøÂç·þÎñ£º
                    service network restart
                    mysqlÊý¾Ý¿â·þÎñµÄÃû³Æ£º
                        mysql°æ±¾µÍÓÚ5.5  mysqld
                        mysql°æ±¾¸ßÓÚ5.5  mysql
           
        chkconfig:ÉèÖÃÊÇ·ñ¿ª»úÆô¶¯           :±ØÐëÕÆÎÕ
            Åж¨ÊÇ·ñ¿ª»úÆô¶¯
                chkconfig iptables list
                2.3.4.5ÊÇon±íʾ¿ª»úÆô¶¯
            ÉèÖÃ
                chkconfig iptables on|off
                   
    ½ø³Ì¹ÜÀí£ºps
        ps:²éµ±Ç°½ø³Ì
            ²é¿´javaµÄ½ø³Ì
            ps -ef | grep java
        jps:==(ps -ef | grep java) Ö»ÓÐÔÚlinuxÖа²×°ÁËJDK²ÅÄÜÓÃ
        kill :ɱËÀij¸ö½ø³Ì
            kill -9 pid
           
    ¶Ë¿Ú¹ÜÀí
        nststat:²é¿´¶Ë¿Ú¿ª·ÅÇé¿ö
            -a:±íʾÁоÙËùÓеÄÁ¬½Ó¡¢·þÎñÆ÷¼àÌý
            -t:ÁгöËùÓÐtcpЭÒéµÄ·þÎñ
            -u:ÁгöËùÓÐudpЭÒéµÄ·þÎñ
            -n:ʹÓö˿ںÅÀ´ÏÔʾ
            -l:ÁгöËùÓеļàÌý
            -p:ÁгöËùÓзþÎñµÄ½ø³Ìid£¨pid£©
            ³£Óãºnetstat -atunlp
       
    redhatµÄselinux°²È«»úÖÆ
        ¹Ø±Õselinux°²È«»úÖÆ
            vim /etc/selinux/config
                SELINUX=disabled
            ÖØÆô»úÆ÷ÉúЧ

·¢²¼Ê±¼ä:2019/11/12 ÔĶÁ:8978´Î À´Ô´:
 


¡¡
技术资æ–?uppage=news.asp·ÖÀà
   
  ÐÐÒµÐÂÎÅ
 
  ¹«Ë¾¶¯Ì¬
 
  ¼¼Êõ×ÊÁÏ
 
  µçÄÔάÐÞ
 
  »Ö¸´°¸Àý
 
  SQLÊý¾Ý¿â
 
  ´ÅÅÌÕóÁÐ
 
  ·þÎñÆ÷
 
  ²ÆÎñÈí¼þ
 
  ÍøÂçÎÊÌâ
 
  linux-XFS
 
  Æ»¹ûµçÄÔ&ϵͳ
 
  °²×¿ÏµÍ³Ïà¹Ø
 
  °ì¹«Îļþ
 
  ²Ù×÷ϵͳ
 
  ÈÕ³£Éú»î(ÑĮ̀)
 
  ÍøÕ¾Ïà¹Ø
 
   
¡¡
ÓÑÇéÁ´½Ó
¡¡
¡¡
 
 
 
   
¹«Ë¾µØÖ·£ºÑĮ̀µçÄÔÊг¡#308
µç»°£º0535-6688830 E-Mail:163@163.com
Copyright©2011-2012 ÑĮ̀Èð³Û¿ÆóÓÐÏÞ¹«Ë¾ All Rights Reserved.
³ICP±¸11014811ºÅ-1
ÄúÊDZ¾Õ¾µÚ λ·ÃÎÊÕß