linux tar 백업 명령 [전송]

블 로그 분류: linux
linux tar
전송:http://www.douban.com/note/57861194/
linux 압축 풀기 tar 명령
2010-01-23 09:17:16
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)                !
--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/local/src/etc  !  ,      /usr/local/src/etc
#     ,           /etc/         !

   :  /tmp   ,      /tmp/etc.tar.gz    etc/passwd     
[root@linux ~]# cd /tmp
[root@linux tmp]# tar -zxvf /tmp/etc.tar.gz etc/passwd
#       tar -ztvf     tarfile       ,         ,
#             !   ! etc.tar.gz       /      !

   :  /etc/           ,       !
[root@linux ~]# tar -zxvpf /tmp/etc.tar.gz /etc
#    -p         ,                !

   :  /home   ,  2005/06/01        
[root@linux ~]# tar -N "2005/06/01" -zcvf home.tar.gz /home

   :     /home, /etc ,    /home/dmtsai
[root@linux ~]# tar --exclude /home/dmtsai -zcvf myfile.tar.gz /home/* /etc

   :  /etc/          /tmp   ,      !
[root@linux ~]# cd /tmp
[root@linux tmp]# tar -cvf - /etc | tar -xvf -
#          cp -r /etc /tmp  ~         !
#               -         - ,     |   ~
#       standard output, standard input       !
#         Bash shell  ,               !
    :
tar -zcvf /app/tomcat/magazinebak/20111207magazine.tar.gz  /app/tomcat/webapps/magazine/common /app/tomcat/webapps/magazine/js 
/app/tomcat/webapps/magazine/company /app/tomcat/webapps/magazine/css /app/tomcat/webapps/magazine/images /app/tomcat/webapps/magazine/magazine 
/app/tomcat/webapps/magazine/WEB-INF/classes  /app/tomcat/webapps/magazine/WEB-INF/spring-cfg  /app/tomcat/webapps/magazine/WEB-INF/strust-cfg
    :
tar -zxvf /app/tomcat/magazinebak/20111207magazine.tar.gz -C temp
     : mkdir    
           rm -rm    

좋은 웹페이지 즐겨찾기