• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Saturday, June 21, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

5 Best Command Line Archive Tools for Linux – Part 1

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
16
VIEWS
Share on FacebookShare on Twitter

Contents

  1. What is Archived file?
  2. Features of Archiving
  3. Area of Application
  4. 1. tar Command
    1. tar options
      1. tar Examples
  5. shar Command
    1. shar options
      1. shar Examples
  6. 3. ar Command
    1. ar options
      1. ar Examples
    2. 4. cpio
    3. cpio options
      1. cpio Examples
  7. 5. Gzip
    1. gzip options
      1. gzip Examples

In our day-to-day life we come across, archived files on the platforms of all kind be it Windows, Mac or Linux. There are several Application program available for all of the platforms to create archive files as well as uncompress them. When it comes to work on Linux Platform, we need to deal with archived files very frequently.

5 Best Command Line Archive Tools for Linux – Part 1

Linux Command Line Archive Tools

Here in this article we will be discussing archive tools available on standard Linux Distribution, their features, Examples, etc. The article divided into two parts, each part contains five command line archive tools (i.e. total of 10 Best Command Line Archive Tools).

What is Archived file?

An archive file is a compressed file which is composed of one or more than one computer files along with metadata.

Features of Archiving

  1. Data Compression
  2. Encryption
  3. File Concatenation
  4. Automatic Extraction
  5. Automatic Installation
  6. Source Volume and Media Information
  7. File Spanning
  8. Checksum
  9. Directory Structure Information
  10. Other Metadata (Data About Data)
  11. Error discovery

Area of Application

  1. Store Computer Files System along with Metadata.
  2. Useful in transferring file locally.
  3. Useful in transferring file over web.
  4. Software Packaging Application.

The useful archiving application on standard Linux distribution follows:

1. tar Command

tar is the standard UNIX/Linux archiving application tool. In its early stage it used to be a Tape Archiving Program which gradually is developed into General Purpose archiving package which is capable of handling archive files of every kind. tar accepts a lot of archiving filter with options.

tar options

  1. -A : Append tar files to existing archives.
  2. -c : Create a new archive file.
  3. -d : Compare archive with Specified filesystem.
  4. -j : bzip the archive
  5. -r : append files to existing archives.
  6. -t : list contents of existing archives.
  7. -u : Update archive
  8. -x : Extract file from existing archive.
  9. -z : gzip the archive
  10. –delete : Delete files from existing archive.
tar Examples

Create a tar archive file.

# tar -zcvf name_of_tar.tar.gz /path/to/folder

Decompress an tar archive file.

# tar -zxvf Name_of_tar_file.tar.gz

For more detailed examples, read 18 Tar Command Examples in Linux.

shar Command

shar which stands for Shell archive is a shell script, the execution of which will create the files. shar is a self-extracting archive file which is a legacy utility and needs Unix Bourne Shell to extract the files. shar has an advantage of being plain text however it is potentially dangerous, since it outputs an executable.

shar options

  1. -o : Save output to archive files as specified, in the option.
  2. -l : Limit the output size, as specified, in the option but do not split it.
  3. -L : Limit the output size, as specified, in the option and split it.
  4. -n : Name of Archive to be included in the header of the shar files.
  5. -a : Allow automatic generation of headers.

Note: The ‘-o‘ option is required if the ‘-l‘ or ‘-L‘ option is used and the ‘-n‘ option is required if the ‘-a‘ option is used.

shar Examples

Create a shar archive file.

# shar file_name.extension > filename.shar

Extract an shar archive file.

# unshar file_name.shar

3. ar Command

ar is the creation and manipulation utility for archives, mainly used for binary object file libraries. ar stands for archiver which can be used to create archive of any kind for any purpose but has largely been replaced by ‘tar’ and now-a-days it is used only to create and update static library files.

ar options

  1. -d : Delete modules from the archive.
  2. -m : Move Members in the archive.
  3. -p : Print specified members of the archive.
  4. -q : Quick Append.
  5. -r : Insert file member to archive.
  6. -s : Add index to archive.
  7. -a : Add a new file to the existing members of archive.
ar Examples

Create an archive using ‘ar‘ tool with a static library say ‘libmath.a‘ with the objective files ‘substraction’ and ‘division’ as.

# ar cr libmath.a substraction.o division.o

To extract an ‘ar’ archive file.

# ar x libmath.a

4. cpio

cpio stands for Copy in and out. Cpio is a general purpose file archiver for Linux. It is actively used by RedHat Package Manager (RPM) and in the initramfs of Linux Kernel as well as an important archiving tool in Apple Computer’s Installer (pax).

cpio options

  1. -0 : Read a list of filenames terminated by a null character instead of a newline.
  2. -a : Reset Access time.
  3. -A : Append.
  4. -b : swap.
  5. -d : Make Directories.
cpio Examples

Create an ‘cpio’ archive file.

# cd tecmint
# ls

file1.o file2.o file3.o

# ls | cpio  -ov > /path/to/output_folder/obj.cpio

To extract a cpio archive file.

# cpio -idv < /path/to folder/obj.cpio

5. Gzip

gzip is standard and widely used file compression and decompression utility. Gzip allows file concatenation. Compressing the file with gzip, outputs the tarball which is in the format of ‘*.tar.gz‘ or ‘*.tgz‘.

gzip options

  1. –stdout : Produce output on standard output.
  2. –to-stdout : Produce output on standard output.
  3. –decompress : Decompress File.
  4. –uncompress : Decompress File.
  5. -d : Decompress File.
  6. -f : Force Compression/Decompression.
gzip Examples

Create an ‘gzip’ archive file.

# tar -cvzf name_of_archive.tar.gz /path/to/folder

To extract a ‘gzip’ archive file.

# gunzip file_name.tar.gz

The above command must be passed followed with below command.

# tar -xvf file_name.tar

Note: The architecture and functionality of ‘gzip’ makes it difficult to recover corrupted ‘gzipped tar archive’ file. It is advised to make several backups of gzipped Important files, at different Locations.

That’s all for now. We will be discussing other compressing and decompressing applications, available for Linux, in our next article. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comment section below.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

The Differences of Xen, KVM, OpenVZ. Which one is right for me?

Next Post

How to Set and Unset Local, User and System Wide Environment Variables in Linux

Next Post

How to Set and Unset Local, User and System Wide Environment Variables in Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In