Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
linux_wiki:archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2 [2016/02/28 22:54] billdozor created |
linux_wiki:archive_compress_unpack_and_uncompress_files_using_tar_star_gzip_and_bzip2 [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 3: | Line 3: | ||
**General Information** | **General Information** | ||
- | About this page/how-to/script. | + | You can do most all with tar, but it doesn' |
---- | ---- | ||
Line 19: | Line 19: | ||
* -u => update a file in an existing archive if the source is newer | * -u => update a file in an existing archive if the source is newer | ||
* -f => archive filename | * -f => archive filename | ||
+ | * --selinux => include selinux contexts | ||
Archive and compress (using gzip) the /var/log directory | Archive and compress (using gzip) the /var/log directory | ||
Line 25: | Line 26: | ||
</ | </ | ||
+ | \\ | ||
List contents of archive | List contents of archive | ||
<code bash> | <code bash> | ||
Line 30: | Line 32: | ||
</ | </ | ||
+ | \\ | ||
Decompress and unpack at the same time to current directory | Decompress and unpack at the same time to current directory | ||
<code bash> | <code bash> | ||
Line 35: | Line 38: | ||
</ | </ | ||
+ | \\ | ||
Decompress and unpack at the same time to a different existing directory | Decompress and unpack at the same time to a different existing directory | ||
<code bash> | <code bash> | ||
Line 40: | Line 44: | ||
</ | </ | ||
+ | \\ | ||
Add a new file to an existing archive | Add a new file to an existing archive | ||
<code bash> | <code bash> | ||
Line 49: | Line 54: | ||
===== star ===== | ===== star ===== | ||
+ | Install (usually not there by default) | ||
+ | <code bash> | ||
+ | yum install star | ||
+ | </ | ||
+ | |||
+ | \\ | ||
Archive and compress the /var/log directory (name it logs.tar.gz) | Archive and compress the /var/log directory (name it logs.tar.gz) | ||
<code bash> | <code bash> | ||
Line 54: | Line 65: | ||
</ | </ | ||
+ | \\ | ||
List archive contents | List archive contents | ||
<code bash> | <code bash> | ||
Line 59: | Line 71: | ||
</ | </ | ||
+ | \\ | ||
Decompress, unpack a bzip2 (star auto selects proper decompression type) | Decompress, unpack a bzip2 (star auto selects proper decompression type) | ||
<code bash> | <code bash> | ||
Line 73: | Line 86: | ||
</ | </ | ||
+ | \\ | ||
Decompress an archive | Decompress an archive | ||
<code bash> | <code bash> | ||
Line 80: | Line 94: | ||
</ | </ | ||
+ | \\ | ||
Cat a compressed file (useful for rotated logs) | Cat a compressed file (useful for rotated logs) | ||
<code bash> | <code bash> | ||
Line 94: | Line 109: | ||
</ | </ | ||
+ | \\ | ||
Decompress an archive | Decompress an archive | ||
<code bash> | <code bash> | ||
Line 101: | Line 117: | ||
</ | </ | ||
+ | \\ | ||
Cat a compressed file (useful for rotated logs) | Cat a compressed file (useful for rotated logs) | ||
<code bash> | <code bash> |