- archive: tying multiple files into one file.
- extensions | ext | create | extract | view | update | compression | leave the origin | dir | |:----:|:---------------------:|:-----------------:|:--------------:|:---------------------:|:-----------:|:----------------:|:---:| | .tar | tar cvf (.tar) (tgts) | tar xvf (.tar) | tar tvf (.tar) | tar uvf (.tar) (tgts) | no | yes | yes | | .jar | jar cvf (.jar) (tgts) | jar xvf (.jar) | jar tvf (.jar) | jar uvf (.jar) (tgts) | yes | yes | yes | | .Z | compress (tgts) | uncompress (tgts) | zcat (.Z) | - | yes | no | no | | .gz | gzip (tgts) | gunzip (.gz) | gzcat (.gz) | - | yes | no | no | | .zip | zip (.zip) (tgts) | unzip (.zip) | - | - | yes | yes | yes | | .bz2 | bzip2 (tgts) | bunzip2 (.bz2) | bzcat (.bz2) | - | yes | no | no |
- Definition: tape archive
- options
- c: create
- v: verbose
- f: file, assigns created archive name.
- options
- x: extract
notes
- paths of files in the archive
- When
tar
creates a archive, it also saves path of each file in it.- These paths of files are used to extract the tar file.
- Hence it would be desirable to check out paths of files in archive by
tar tvf
.
- file permissions
- The permission of extracted file is depending on default umask.
- If the original permission should be maintained, use
p
option.
- options
- t: table of contents
- columns
- the type of the file
- the file permission
- UID/GID
- file size
- last modified date
- file name
- options
- u: update
- adds a file to the tar file
- 'cause the files of the archive are extracted in order from top to bottom, the last file overwrites the first file.
rvf
r: replace uvf checks if the same file already exists in the archive, whereas rvf adds a file to the archive unconditionally.
- Definition: Java ARchive tool
- options: same as
tar
. - only create:
jar c0vf
- options: same as
tar
.
note: when extracts the symbolic file
tar xvf: extract the symbolic file.(-h: extracts the origin file.) jar xvf: extract not the symbolic file but the origin file.
- options: same as
tar
. META-INF/MANIFEST.MF
: management and authentication info
- options: same as
tar
. - Unlike
tar uvf
which adds updated file to the archive,jar uvf
substitutes the origin file with the updated file.