Rob's web

Archives

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.

tar

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.

OptionsDescription
-cCreates an archive by bundling files and directories together.
-xExtracts files and directories from an existing archive.
-fSpecifies the filename of the archive to be created or extracted.
-tDisplays or lists the files and directories contained within an archive.
-uArchives and adds new files or directories to an existing archive.
-vDisplays verbose information, providing detailed output during the archiving or extraction process.
-AConcatenates multiple archive files into a single archive.
-zUses gzip compression when creating a tar file, resulting in a compressed archive with the '.tar.gz' extension.
-jUses bzip2 compression when creating a tar file, resulting in a compressed archive with the '.tar.bz2' extension.
-WVerifies the integrity of an archive file, ensuring its contents are not corrupted.
-rUpdates or adds files or directories to an already existing archive without recreating the entire archive.

Creating archive

# tar -tzvf archive.tar.gz archive/*

Testing an archive

# tar -tvf archive.tar.gz

Extracting files from archive

# tar -xvf archive.tar.gz

zip

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

# zip [options] [output_file.zip] [list_of_files_or_directories]

unzip

# unzip output.zip