Difference between revisions of "Linux tar"
From John Freier
| (3 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
Tar commands | Tar commands | ||
| + | == Create an archive == | ||
| + | To tar up a folder. Using * will not include .hidden files. If you want to include all file including .hidden files, use . like in the example below. | ||
| + | tar -czf ./destination.tgz ./source/. | ||
| − | + | These options mean | |
| − | tar - | + | c - create a new archive |
| + | z - use gzip to compress the archive | ||
| + | f - file | ||
| + | |||
| + | When using tar, these are the extensions. | ||
| + | *.tar - just archived no compression | ||
| + | *.tgz - dos use to only allow three char extensions, so this is tar and gziped. | ||
| + | *.tar.gz - modern extension for tar and gzip compressed. | ||
| + | |||
| + | |||
| + | == Extract an archive == | ||
| + | To extract an arcive | ||
| + | tar -zxvf ./file.tgz | ||
| + | |||
| + | These options mean | ||
| + | z - decompres using gzip | ||
| + | x - Extract to disk from the archive | ||
| + | v - Verbose output, show all the files while extracting. | ||
| + | f - file | ||
Latest revision as of 20:49, 17 March 2016
Tar commands
Create an archive
To tar up a folder. Using * will not include .hidden files. If you want to include all file including .hidden files, use . like in the example below.
tar -czf ./destination.tgz ./source/.
These options mean
c - create a new archive z - use gzip to compress the archive f - file
When using tar, these are the extensions.
*.tar - just archived no compression *.tgz - dos use to only allow three char extensions, so this is tar and gziped. *.tar.gz - modern extension for tar and gzip compressed.
Extract an archive
To extract an arcive
tar -zxvf ./file.tgz
These options mean
z - decompres using gzip x - Extract to disk from the archive v - Verbose output, show all the files while extracting. f - file