To make an archive or a backup we use a compressiontool to make a solid file of a directory. The most common is TAR, with was used to write to a backup-tape without compression.
It is also possible to write to a file with compression. We get what is called a tar-ball.
When we want to distribute source-code we can use source.tar.gz files. These can than be downloaded as a complete pack.
The Linux 'tar' stands for tape archive, which is used to create Archive and extract the Archive files. tar command in Linux is one of the important commands that provides archiving functionality in Linux. We can use the Linux tar command to create compressed or uncompressed Archive files and also maintain and modify them.
Options | Description |
---|---|
-c | Creates an archive by bundling files and directories together. |
-x | Extracts files and directories from an existing archive. |
-f | Specifies the filename of the archive to be created or extracted. |
-t | Displays or lists the files and directories contained within an archive. |
-u | Archives and adds new files or directories to an existing archive. |
-v | Displays verbose information, providing detailed output during the archiving or extraction process. |
-A | Concatenates multiple archive files into a single archive. |
-z | Uses gzip compression when creating a tar file, resulting in a compressed archive with the '.tar.gz' extension. |
-j | Uses bzip2 compression when creating a tar file, resulting in a compressed archive with the '.tar.bz2' extension. |
-W | Verifies the integrity of an archive file, ensuring its contents are not corrupted. |
-r | Updates or adds files or directories to an already existing archive without recreating the entire archive. |
# tar -tzvf archive.tar.gz archive/*
# tar -tvf archive.tar.gz
# tar -xvf archive.tar.gz
Linux als support zip files.
If you want an archive that should be used on windows use zip.
To test if zip is installed type zip on the coomand line. It should show the options. If not install zip.
# dnf install zip
# zip [options] [output_file.zip] [list_of_files_or_directories]
# unzip output.zip