{"id":784,"date":"2018-07-02T11:22:55","date_gmt":"2018-07-02T08:22:55","guid":{"rendered":"http:\/\/leonidassavvides.com\/blog\/?p=784"},"modified":"2018-07-02T11:22:55","modified_gmt":"2018-07-02T08:22:55","slug":"backup-archive-compress-linux-files-tricks","status":"publish","type":"post","link":"https:\/\/www.leonidassavvides.com\/blog\/2018\/07\/backup-archive-compress-linux-files-tricks\/","title":{"rendered":"Backup, archive, compress Linux files tricks"},"content":{"rendered":"<div style=\"margin-top: 0px; margin-bottom: 0px;\" class=\"sharethis-inline-share-buttons\" ><\/div><p style=\"text-align: center;\">Backup, archive, compress Linux files tricks<\/p>\n<p style=\"text-align: center;\">==================<\/p>\n<p>Some of Linux Backup Utilities are<\/p>\n<p><strong>cpio tar gzip bzip2 xz dd rsync dump restore mt<\/strong><\/p>\n<p>Also exist some Backup Programs for Linux like <strong>Amanda <\/strong>and <strong>Bacula<\/strong><\/p>\n<p>Some commands you may use with the Backup Utilities above are [\/dev\/st0 tape exist the backup or other storage medium]<\/p>\n<pre>cpio<\/pre>\n<pre>ls | cpio --create -o \/dev\/st0  # create an archive\n\ncpio -i *.c -I \/dev\/st0   \n# extract *.c files from archive if no RE all extracted\n\ncpio -t -I \/dev\/st0  # list archive contents\n\ntar<\/pre>\n<pre>tar --create --file \/dev\/st0 \/root  \ntar -cvf \/dev\/st0 \/root\ntar cvf file.tar dir1  # \"-\" is optional for tar command\n# create an archive\n\ntar --extact --same-permissions --verbose --file \/dev\/st0\ntar -xpvf \/dev\/st0\ntar xpvf \/dev\/st0\n# extract from archive\n\ntar xvf \/dev\/st0 *.c  # restore only *.c files\n\ntar --list --file \/dev\/st0  # list contents of tar backup\ntar -tf \/dev\/st0\n\ngzip, bzip, xz\n\ntar zcvf source.tar.gz source  # compress as gz in combination with tar \n\ntar jcvf source.tar.bz2 source  # compress as bzip in combination with tar \n\ntar Jcvf source.tar.xz source  # compress as xz in combination with tar \n\nthese commands are more efficient than the two together commands:\ntar cvf source.tar source ; gzip -v source.tar  # because this has intermediate step but above archiving and compression happen same time\n\nextraction\ntar xzvf source.tar.gz\ntar xjvf source.tar.bz2\ntar xJvf source.tar.xz\n\nmodern version of tar detect compression used auto and Not needed z in extraction\ntar xvf source.tar.gz\n\nrsync  \/\/ Synchronize the two file system locations - or between the network machines(folders of)\nrsync file.tar someone@backup.mydomain:\/usr\/local\nrsync -r a-machine:\/usr\/local b-machive:\/usr\/\nrsync -r --dry-run \/usr\/local \/BACKUP\/usr\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Backup, archive, compress Linux files tricks ================== Some of Linux Backup Utilities are cpio tar gzip bzip2 xz dd rsync dump restore mt Also exist some Backup Programs for Linux like Amanda and Bacula Some commands you may use with the Backup Utilities above are [\/dev\/st0 tape exist the backup or other storage medium] cpio &hellip; <a href=\"https:\/\/www.leonidassavvides.com\/blog\/2018\/07\/backup-archive-compress-linux-files-tricks\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Backup, archive, compress Linux files tricks&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[43],"tags":[],"class_list":["post-784","post","type-post","status-publish","format-standard","hentry","category-tech"],"_links":{"self":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts\/784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/comments?post=784"}],"version-history":[{"count":0,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/posts\/784\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/media?parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/categories?post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.leonidassavvides.com\/blog\/wp-json\/wp\/v2\/tags?post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}