Commands.page Logo

How to Create Tar Archive Without Compression in Ubuntu

This article provides a straightforward guide on generating uncompressed tar archives within the Ubuntu operating system. It covers the essential command-line syntax required to bundle files and directories into a single .tar file without using gzip or bzip2 compression. Following these steps ensures faster archive creation when file size reduction is not a priority.

The Basic Tar Command

To create an archive without compression, you need to use the tar command without any compression flags. Common compression flags like -z for gzip or -j for bzip2 should be excluded. The core flags required are -c to create an archive, -v to view the progress verbosely, and -f to specify the filename.

Syntax and Example

The standard syntax for creating an uncompressed tar file is as follows:

tar -cvf archive_name.tar path_to_files

For example, if you want to archive a folder named documents into a file called backup.tar, you would run:

tar -cvf backup.tar documents

This command bundles the contents of the documents folder into backup.tar immediately. Because no compression algorithm is applied, this process is significantly faster than creating a .tar.gz file, though the resulting file size will be larger.

Extracting the Archive

To extract the files from the uncompressed archive later, use the -x flag instead of -c. The command structure remains similar:

tar -xvf backup.tar

This will unpack the contents of the archive into the current directory. Using uncompressed tar archives is ideal for local backups or when transferring data between systems where CPU usage for compression is a concern.