LinuxѹËõ´ò°üÃüÁîʹÓ÷½·¨
http://www.ixpub.net/619016.html
tarÃüÁî
[root@linux ~]# tar [-cxtzjvfpPN] Îļþ
ÓëĿ¼ ....
²ÎÊý£º
-c £º½¨Á¢Ò»¸öѹËõÎļþµÄ²ÎÊýÖ¸Áî(create µÄÒâ˼)£»
-x £º½â¿ªÒ»¸öѹËõÎļþµÄ²ÎÊýÖ¸Á
-t £º²é¿´ tarfile ÀïÃæµÄÎļþ£¡
Ìرð×¢Ò⣬ÔÚ²ÎÊýµÄÏ´ïÖУ¬ c/x/t ½öÄÜ´æÔÚÒ»¸ö£¡²»¿Éͬʱ´æÔÚ£¡
ÒòΪ²»¿ÉÄÜͬʱѹËõÓë½âѹËõ¡£
-z £ºÊÇ·ñͬʱ¾ßÓÐ gzip µÄÊôÐÔ£¿Ò༴ÊÇ·ñÐèÒªÓà gzip ѹËõ£¿
-j £ºÊÇ·ñͬʱ¾ßÓÐ bzip2 µÄÊôÐÔ£¿Ò༴ÊÇ·ñÐèÒªÓà bzip2 ѹËõ£¿
-v £ºÑ¹ËõµÄ¹ý³ÌÖÐÏÔʾÎļþ£¡Õâ¸ö³£Ó㬵«²»½¨ÒéÓÃÔÚ±³¾°Ö´Ðйý³Ì£¡
-f £ºÊ¹ÓõµÃû£¬ÇëÁôÒ⣬ÔÚ f Ö®ºóÒªÁ¢¼´½ÓµµÃûร¡²»ÒªÔÙ¼Ó²ÎÊý£¡
¡¡¡¡¡¡ÀýÈçʹÓẠtar -zcvfP tfile sfile¡»¾ÍÊÇ´íÎóµÄд·¨£¬ÒªÐ´³É
¡¡¡¡¡¡¡º tar -zcvPf tfile sfile¡»²Å¶Ôร¡
-p £ºÊ¹ÓÃÔÎļþµÄÔÀ´ÊôÐÔ£¨ÊôÐÔ²»»áÒÀ¾ÝʹÓÃÕ߶ø±ä£©
-P £º¿ÉÒÔʹÓþø¶Ô·¾¶À´Ñ¹Ëõ£¡
-N £º±ÈºóÃæ½ÓµÄÈÕÆÚ(yyyy/mm/dd)»¹ÒªÐµIJŻᱻ´ò°ü½øн¨µÄÎļþÖУ¡
--exclude FILE£ºÔÚѹËõµÄ¹ý³ÌÖУ¬²»Òª½« FILE ´ò°ü£¡
·¶Àý£º
·¶ÀýÒ»£º½«Õû¸ö /etc Ŀ¼ÏµÄÎļþÈ«²¿´ò°ü³ÉΪ /tmp/etc.tar
[root@linux ~]# tar -cvf /tmp/etc.tar /etc <==½ö´ò°ü£¬²»Ñ¹Ëõ£¡
[root@linux ~]# tar -zcvf /tmp/etc.tar.gz /etc <==´ò°üºó£¬ÒÔ gzip ѹËõ
[root@linux ~]# tar -jcvf /tmp/etc.tar.bz2 /etc <==´ò°üºó£¬ÒÔ bzip2 ѹËõ
# Ìرð×¢Ò⣬ÔÚ²ÎÊý f Ö®ºóµÄÎļþµµÃûÊÇ×Ô¼ºÈ¡µÄ£¬ÎÒÃÇÏ°¹ßÉ϶¼Óà .tar À´×÷Ϊ±æʶ¡£
# Èç¹û¼Ó z ²ÎÊý£¬ÔòÒÔ .tar.gz »ò .tgz À´´ú±í gzip ѹËõ¹ýµÄ tar file ¡«
# Èç¹û¼Ó j ²ÎÊý£¬ÔòÒÔ .tar.bz2 À´×÷Ϊ¸½µµÃû°¡¡«
# ÉÏÊöÖ¸ÁîÔÚÖ´ÐеÄʱºò£¬»áÏÔʾһ¸ö¾¯¸æѶϢ£º
# ¡ºtar: Removing leading `/' from member names¡»ÄÇÊǹØ춾ø¶Ô·¾¶µÄÌØÊâÉ趨¡£
·¶Àý¶þ£º²éÔÄÉÏÊö /tmp/etc.tar.gz ÎļþÄÚÓÐÄÄЩÎļþ£¿
[root@linux ~]# tar -ztvf /tmp/etc.tar.gz
# ÓÉì¶ÎÒÃÇʹÓà gzip ѹËõ£¬ËùÒÔÒª²éÔĸà tar file ÄÚµÄÎļþʱ£¬
# ¾ÍµÃÒª¼ÓÉÏ z Õâ¸ö²ÎÊýÁË£¡ÕâºÜÖØÒªµÄ£¡
·¶ÀýÈý£º½« /tmp/etc.tar.gz Îļþ½âѹËõÔÚ /usr/local/src µ×ÏÂ
[root@linux ~]# cd /usr/local/src
[root@linux src]# tar -zxvf /tmp/etc.tar.gz
# ÔÚÔ¤ÉèµÄÇé¿öÏ£¬ÎÒÃÇ¿ÉÒÔ½«Ñ¹ËõµµÔÚÈκεط½½â¿ªµÄ£¡ÒÔÕâ¸ö·¶ÀýÀ´Ëµ£¬
# ÎÒÏȽ«¹¤×÷Ŀ¼±ä»»µ½ /usr/local/src µ×Ï£¬²¢Çҽ⿪ /tmp/etc.tar.gz £¬
# Ôò½â¿ªµÄĿ¼»áÔÚ /usr/lo
Ïà¹ØÎĵµ£º
./configure ¼ì²éϵͳÐÅÏ¢
./configure --help | more °ïÖúÐÅÏ¢
make clean   ......
ÏÈÀ´Á˽âÒ»ÏÂÎļþÊôÐÔ£¬
ÔÚshell»·¾³ÀïÊäÈ룺ls -l ¿ÉÒԲ鿴µ±Ç°Ä¿Â¼Îļþ¡£È磺
drwxr-xr-x 2 nsf users 1024 12-10 17:37 ÏÂÔØÎļþ±¸·Ý
·Ö±ð¶ÔÓ¦µÄÊÇ£º
ÎļþÊôÐÔ Á¬½ÓÊý ÎļþÓµÓÐÕß ËùÊôȺ×é Îļþ´óС ÎļþÐÞ¸Äʱ¼ä ÎļþÃû
ÕâÀïrÊǿɶÁ£¬w¿Éд,x ¿ÉÖ´ÐУ¬ÆäÖÐÎļþÊôÐÔ·ÖΪËĶΣ¬---- --- --- 10¸öλÖÃ
ÀýÈ磺
¡¡¡¡d ......
LinuxϵͳÏ»ù±¾ÃüÁ ÒªÇø·Ö´óСд uname ÏÔʾ°æ±¾ÐÅÏ¢£¨Í¬win2KµÄ ver£© dir ÏÔʾµ±Ç°Ä¿Â¼Îļþ,ls -al ÏÔʾ°üÀ¨Òþ²ØÎļþ£¨Í¬win2KµÄ dir£© pwd ²éѯµ±Ç°ËùÔÚµÄĿ¼λÖà cd cd¡¡..»Øµ½ÉÏÒ»²ãĿ¼£¬×¢Òâcd Óë..Ö®¼äÓпոñ¡£cd¡¡/·µ»Øµ½¸ùĿ¼¡£ cat ÎļþÃû ²é¿´ÎļþÄÚÈÝ cat >abc.txt Íùabc.txtÎļþÖÐдÉÏÄÚÈÝ¡£ more Î ......
ËäȻѧ¹ý
Linux Shell
±à³Ì£¬µ«ÓÉÓÚ±àд
Shell
½Å±¾µÄ»ú»áʵÔÚÊDZȽÏÉÙ
(
ͨ³£ÔÚÏîÄ¿³õÆڴ¿ª·¢»·¾³Ê±±àдµÃ±È½Ï
¶àһЩ
)
£¬ËùÒÔÒ»
ЩÓï·¨¾Ã¶ø¾ÃÖ®¾Í»áÍüÁË£¬Ò»¸ö¼òµ¥µÄÓ﷨ȥ·ÊéЧÂÊʵÔÚÊÇÂý£¬ËùÒԾ͸öÈËÕûÀíÁËÒ»¸ö±í¸ñ£¬ÓÉÓÚÎÒÓõıà³ÌÓïÑÔÊÇ
C/C++
£¬ËùÒÔÔÚ±à³ÌµÄʱºòÍùÍùÄÔº£ÀïÃæÊ×
Ïȸ¡ÏÖµÄÊÇÓÃ
C
......