-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Zed <[email protected]>
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: tar | ||
category: CLI | ||
layout: 2017/sheet | ||
updated: 2022-08-11 | ||
intro: Concatenate, Deflate, Inflate files | ||
--- | ||
## Reference | ||
{:.-two-column} | ||
|
||
### Deflate / Inflate / Concatenate | ||
```shell | ||
# Deflate / Compress | ||
tar -czf archive.tar.gz /path/files | ||
``` | ||
|
||
```shell | ||
# Inflate / Uncompress | ||
tar -xzf archive.tar.gz | ||
``` | ||
|
||
```shell | ||
# Concatenate files into a single tar | ||
tar -cf archive.tar /path/files | ||
``` | ||
|
||
```shell | ||
# Extract file to a defined directory | ||
tar -xzf archive.tar.gz -C /target/directory | ||
``` | ||
|
||
```shell | ||
# Append a file to an existing archive | ||
tar -zu archive.tar.gz -C /target/file | ||
``` | ||
|
||
### Common options | ||
|
||
| Option | Description | | ||
|--------|--------------------------------------------------------------------------| | ||
| `z` | compress with gzip | | ||
| `c` | create an archive | | ||
| `u` | append files which are newer than the corresponding copy ibn the archive | | ||
| `f` | filename of the archive | | ||
| `v` | verbose, display what is inflated or deflated | | ||
| `a` | unlike of `z`, determine compression based on file extension | |