tar - [options] <destination_file_name> <source_file>
tar -cvf test.tar /path/folder/to/compress
-c
: Creating an archive-v
: Verbose-f
: Specifies a destination filenameThe extension of a tar archive is .tar
Warning: Linux does not take care of file extensions.For organization and simplicity reasons, you should think about adding the extension in the file name
tar -czvf test.tar /path/folder/to/compress
-c
: Creating an archive-z
: Compression gzip-v
: Verbose-f
: Specifies the source filename to be extracted.The extension of a tar archive with gzip compression is .tar.gz
tar -cjvf test.tar /path/to/compress
-c
: Creating an archive-j
: Compression bzip-v
: Verbose-f
: Specifies the source filename to be extracted.The extension of a tar archive with bzip compression is .tar.bz
tar -xvf test.tar /path/folder/destination
-x
: Extracting an archive-v
: Verbose-f
: Specifies a destination filenameThe extension of a tar archive is .tar
tar -xzvf test.tar /path/folder/to/compress
-x
: Extracting an archive-z
: Compression gzip-v
: Verbose-f
: Specifies the source filename to be extracted.The extension of a tar archive with gzip compression is .tar.gz
tar -xjvf test.tar /path/folder/to/compress
-x
: Extracting an archive-j
: Compression bzip-v
: Verbose-f
: Specifies the source filename to be extracted.The extension of a tar archive with bzip compression is .tar.bz
tar -tf <archive_name>
tar -rvf tutorials.tar additional_file.tuto
-C
: Defines the working directory, equivalent to the cd
command.