linux_wiki:archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2 [2016/02/29 22:47]
billdozor [star]
linux_wiki:archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2 [2019/05/25 23:50]
Line 1: Line 1:
-====== Archive Compress Unpack And Uncompress Files Using Tar Star Gzip And Bzip2 ====== 
- 
-**General Information** 
- 
-About this page/how-to/script.  
- 
----- 
- 
-===== tar ===== 
- 
-Options 
-  * -c => create new archive 
-  * -t => list contents of archive 
-  * -x => extract files from archive 
-  * -z => compress or decompress in gzip (depending upon if -x or -c was also passed) 
-  * -v => display files as they are processed 
-  * -j => use bzip2 
-  * -r => append/add file to the end of the existing archive 
-  * -u => update a file in an existing archive if the source is newer 
-  * -f => archive filename 
-  * --selinux => include selinux contexts 
- 
-Archive and compress (using gzip) the /var/log directory 
-<code bash> 
-tar -cvzf logs.tar.gz /var/log 
-</code> 
- 
-\\ 
-List contents of archive 
-<code bash> 
-tar -tf logs.tar.gz 
-</code> 
- 
-\\ 
-Decompress and unpack at the same time to current directory 
-<code bash> 
-tar -zxvf logs.tar.gz 
-</code> 
- 
-\\ 
-Decompress and unpack at the same time to a different existing directory 
-<code bash> 
-tar -zxvf logs.tar.gz -C /home/rjones/data/ 
-</code> 
- 
-\\ 
-Add a new file to an existing archive 
-<code bash> 
-tar -rvf logs.tar newlog.log 
-</code> 
- 
----- 
- 
-===== star ===== 
- 
-Install (usually not there by default) 
-<code bash> 
-yum install star 
-</code> 
- 
-\\ 
-Archive and compress the /var/log directory (name it logs.tar.gz) 
-<code bash> 
-star -cz -f logs.tar.gz /var/log 
-</code> 
- 
-\\ 
-List archive contents 
-<code bash> 
-star -t -f logs.tar 
-</code> 
- 
-\\ 
-Decompress, unpack a bzip2 (star auto selects proper decompression type) 
-<code bash> 
-star -x -f logs.tar.bz2 
-</code> 
- 
----- 
- 
-===== gzip ===== 
- 
-Compress an archive 
-<code bash> 
-gzip logs.tar 
-</code> 
- 
-\\ 
-Decompress an archive 
-<code bash> 
-gzip -d logs.tar.gz 
-OR 
-gunzip logs.tar.gz 
-</code> 
- 
-\\ 
-Cat a compressed file (useful for rotated logs) 
-<code bash> 
-zcat messages.1.log.gz 
-</code> 
- 
----- 
- 
-===== bzip2 ===== 
- 
-Compress an archive 
-<code bash> 
-bzip2 logs.tar 
-</code> 
- 
-\\ 
-Decompress an archive 
-<code bash> 
-bzip2 -d logs.tar.bz2 
-OR 
-bunzip2 logs.tar.bz2 
-</code> 
- 
-\\ 
-Cat a compressed file (useful for rotated logs) 
-<code bash> 
-bzcat messages.1.log.bz2 
-</code> 
- 
----- 
  
  • linux_wiki/archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)