Linux tar command usage
Table of Contents
The frequently used tar command are listed as follows:
1 Create an archive:
tar -cvf archive.tar files_to_add/folder_to_add |
the corresponding extract command:
tar -xvf archive.tar |
2 Create a gzipped archive:
tar -cvzf archive.tar.gz files_to_add/folder_to_add |
The corresponding extract command:
tar -xvfz archive.tar.gz |
3 List the files in an archive
tar -tvf archive.tar |
or
tar -tvfz archive.tar.gz |
4 Add a file or directory to an existing archive
tar -rvf archive.tar files_to_add |