Difference between revisions of "Archiving With GNU tar"
From Free Knowledge Base- The DUCK Project: information for everyone
(Created page with " Back up directory with full path tar -p -zcvf /world2018021802.tgz /usr/local/minecraft/world Restore with path relative from the current directory tar xvzf world2018021...") |
|||
(2 intermediate revisions by one user not shown) | |||
Line 2: | Line 2: | ||
Back up directory with full path | Back up directory with full path | ||
− | tar -p -zcvf /world2018021802.tgz /usr/local/ | + | tar -p -zcvf /world2018021802.tgz /usr/local/xtar/world |
− | Restore with path relative from the current directory | + | Restore with path relative from the current directory (tar extract) |
tar xvzf world2018021802.tgz | tar xvzf world2018021802.tgz | ||
tar -P xvzf | tar -P xvzf | ||
+ | |||
+ | other | ||
+ | |||
+ | tar -sp -zcvf var-lib-mysql.tar.gz /var/lib/mysql -P | ||
+ | |||
+ | tarball: | ||
+ | |||
+ | tar -sp -zcvf mysqlhotcopy.tar.gz /home/username/placetoputbackupfile -P | ||
+ | |||
+ | tar -sp -zcvf archive.tar.gz /mounted/directory -P | ||
+ | |||
+ | List contents of filename.tar to the screen | ||
+ | |||
+ | tar -tvf filename.tar | ||
+ | |||
+ | List the contents of a gnuzip (gzip) compressed tar archive. | ||
+ | |||
+ | tar -ztf name-of-file.tgz | ||
+ | |||
+ | Verbosely | ||
+ | |||
+ | tar -ztvf name-of-file.tgz | ||
+ | |||
+ | Search the archive | ||
+ | |||
+ | tar -ztf name-of-file.tgz | grep -i "search string" | ||
+ | |||
+ | Verbosely | ||
+ | |||
+ | tar -ztvf name-of-file.tgz | grep -i "search string" | ||
+ | |||
+ | [[Category:Computer_Technology]] | ||
+ | [[Category:Linux]] |
Latest revision as of 20:57, 6 June 2018
Back up directory with full path
tar -p -zcvf /world2018021802.tgz /usr/local/xtar/world
Restore with path relative from the current directory (tar extract)
tar xvzf world2018021802.tgz
tar -P xvzf
other
tar -sp -zcvf var-lib-mysql.tar.gz /var/lib/mysql -P
tarball:
tar -sp -zcvf mysqlhotcopy.tar.gz /home/username/placetoputbackupfile -P
tar -sp -zcvf archive.tar.gz /mounted/directory -P
List contents of filename.tar to the screen
tar -tvf filename.tar
List the contents of a gnuzip (gzip) compressed tar archive.
tar -ztf name-of-file.tgz
Verbosely
tar -ztvf name-of-file.tgz
Search the archive
tar -ztf name-of-file.tgz | grep -i "search string"
Verbosely
tar -ztvf name-of-file.tgz | grep -i "search string"