tar
- Archiving utility. Often combined with a compression method, such as gzip or bzip.
Syntax
1
| tar [OPTION...] [FILE]...
|
Option |
Description |
-c |
create a new archive |
-f |
specify archive file |
-t |
list |
-x |
extract |
–exclude |
exclude files, given as a pattern |
Compression Option |
Description |
-z |
use gzip |
-j |
use bzip2 |
-Z |
use compress |
Example
Create archive from files
1
| tar -cvf archive.tar file1 file2 dir1 dir2
|
Create gzipped archive
1
| tar -czvf archive.tar.gz file1 file2 dir1 dir2
|
List files in archive
List files in gzipped archive
1
| tar -tzvf archive.tar.gz
|
1
| tar -xzvf archive.tar.gz
|
1
| tar -xvf archive.tar -C dest
|
1
| tar -xvf archive.tar file1
|
Reference