{"id":1701,"date":"2012-11-14T20:29:01","date_gmt":"2012-11-14T12:29:01","guid":{"rendered":"http:\/\/rmohan.com\/?p=1701"},"modified":"2012-11-14T20:29:01","modified_gmt":"2012-11-14T12:29:01","slug":"tar","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=1701","title":{"rendered":"tar"},"content":{"rendered":"<p>tar [-cxtzjvfpPN] file and directory &#8230;. <br \/>parameters:<\/p>\n<p>-c: create a compressed file parameters command (create mean); <br \/>-x: parameter instructions to unlock a compressed file! <br \/>-T: View file tarfile inside! <br \/>Special attention to the parameters issued, c \/ x \/ t only the existence of a! Not exist! <br \/>Because it is not possible at the same time compression and decompression. <br \/>-Z: whether gzip attributes? That is, the need to use gzip compression? <br \/>-J: whether bzip2 attributes? That is, the need to use the bzip2 compression? <br \/>-V: compressed file! This commonly used, but is not recommended for use in the background during the execution! <br \/>-F: use the file name, please pay attention to, and then to immediately after the f file name Oh! Do not plus Parameters! <br \/>???For example, the use of &#8220;tar-zcvfP tfile sfile&#8221; is the wrong wording to be written as <br \/>???&#8221;tar-zcvPf tfile sfile&#8221; fishes Oh! <br \/>-P: the original with the original file attributes (based on user attributes are not changed) <br \/>-P: You can use an absolute path compression! <br \/>-N: than followed by the date (yyyy \/ mm \/ dd) also will be packaged into a new file! <br \/>&#8211; Exclude FILE: In the process of compression, not to FILE packaging! <br \/>Example: <br \/>Example: all packaged into the file under the \/ etc directory \/ tmp \/ etc.tar <br \/>[root@rmohan.com to] # tar -cvf \/tmp \/etc.tar \/ etc &lt;== only packaged not compressed! <br \/>[Root@rmohan.com ~] # tar-zcvf \/tmp \/etc.tar.gz \/ etc &lt;== packed gzip compression <br \/>[root@rmohan.com ~] # tar-jcvf \/tmp\/bzip2 compression <br \/># etc.tar.bz2 \/ etc &lt;== packed special attention to, in the name of the file, after the parameter f taken their own, we are accustomed to using. tar as identification. <br \/># <br \/>plus j parameters by. tar.bz2 as an attached file name ah plus z parameters by. tar.gz or. tgz to represent gzip compressed tar file ~~ # ~ <br \/># in the implementation of the above command when will display a warning message: <br \/># tar: Removing leading `\/&#8221; from member names &#8220;that a special set absolute path.<\/p>\n<p>Example: inspection which files the above \/ tmp \/ etc.tar.gz file? <br \/>The [root@rmohan.com] # tar-ztvf \/ tmp \/ etc.tar.gz <br \/># Since we use gzip compression, so you want to access the file within the tar file, <br \/># you have to add z this parameter ! This is very important!<\/p>\n<p>Example: \/ tmp \/ etc.tar.gz file decompression beneath \/ usr \/ local \/ src <br \/>[root@rmohan.com ~~] # cd \/ usr \/ local \/ src <br \/>[root@rmohan.com src ] # tar-zxvf \/ tmp \/ etc.tar.gz <br \/># In the case of default, we can unlock the archive anywhere! <br \/># My working directory first conversion to \/ usr \/ local \/ src underneath this example and untied \/ tmp \/ etc.tar.gz, and <br \/># then unlock directory in \/ usr \/ local \/ src \/ etc too! Also, if you enter the \/ usr \/ local \/ src in \/ etc <br \/># is found, the file attributes in the directory \/ etc \/ may be different Oh!<\/p>\n<p>Example: \/ tmp under, I only want to \/ tmp \/ etc \/ passwd etc.tar.gz within untie. <br \/>[root@rmohan.com ~~] # cd the \/ tmp <br \/>[root@www.linuxidc. com tmp] # tar-zxvf \/ tmp \/ etc.tar.gz etc \/ passwd <br \/># I can through tar-ztvf to access the file name in the tarfile if single for so long as a file <br \/># can through issued Noticed! the root within etc.tar.gz catalog \/ is removed!<\/p>\n<p>Example: backup all the files in the \/ etc \/ down, and save their permission! <br \/>[Root@rmohan.com to] # tar-zxvpf \/ tmp \/ etc.tar.gz \/ etc <br \/>#-p attribute is very important, especially when you want to keep the original file attributes!<\/p>\n<p>EXAMPLE 6: in \/ home them than 2005\/06\/01 new file backup the <br \/>[root@rmohan.com] # tar-N &#8220;2005\/06\/01&#8221;-zcvf home.tar.gz \/ home<\/p>\n<p>Example 7: I want to back up \/ home, \/ etc., but do not \/ home \/ dmtsai in <br \/>root@rmohan.com ~~] # tar &#8211; exclude \/ home \/ dmtsai-zcvf myfile.tar.gz \/ home \/ * \/ etc<\/p>\n<p>Example 8: \/ etc \/ packaged under the \/ tmp, without producing documents direct unlock! <br \/>[Root@rmohan.com] # cd \/ tmp <br \/>[root@rmohan.com tmp] # tar-cvf &#8211; \/ etc | tar-xvf &#8211; <br \/># This action is a bit like cp-r \/ etc \/ tmp! ~ still has its uses! <br \/># To note is that the output file into the &#8211; input file has become &#8211; have a | ~ <br \/># represent the standard output, standard input and pipeline command exists friends!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>tar [-cxtzjvfpPN] file and directory &#8230;. parameters:<\/p>\n<p>-c: create a compressed file parameters command (create mean); -x: parameter instructions to unlock a compressed file! -T: View file tarfile inside! Special attention to the parameters issued, c \/ x \/ t only the existence of a! Not exist! Because it is not possible at the same [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1701"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1701"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1701\/revisions"}],"predecessor-version":[{"id":1704,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/1701\/revisions\/1704"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1701"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1701"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1701"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}