- How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS
- How to Running Varnish 3.0 in Front of Nginx, PHP5.4 (PHP-FPM)
- How to Configure Static IP Address on RHEL 7.0/CentOS 7.0
- How to Install ifconfig and netstat on RHEL 7.0/CentOS 7.0
- How to Upgrade Zimbra Collaboration Suite 8.0.7 to 8.5.0 on CentOS 6.5 x86_64
Archiving and compressing files are useful when creating backups and transferring data across a network. One of the oldest and most common commands for creating and working with the backup archives is tar command. tar originally stood for tape archiver. With tar, we cab gather large sets of the files into a single file(archive). We can indicate that the archive should be compressed using gzip or bzip2 compression.
To use tar command, one of the three following options is required.
c = create and archive
x = extract and archive or
t = test or list the contents of an archive
Other options let you add vebosity(v), indicate the name of the archive file to create or extract and set the type of compression to use (g for gzip or j or bzip2).
This example will show an examples of tar syntax which will create (c) a gzip compressed(z) archive file (f /tmp/etc.tar.gz) of the /etc directory. Be verbose(v) with the output. This command has been tested on Redhat Enterprise Linux 6 (RHEL6) with root access and it will backup entire /etc directory.
[root@rhel6 ~]# tar cvzf /tmp/etc.tar.gz /etc
Meanwhile, this tar command will show hpw to extract(x) and view(v) all files from a gzip-compressed(z) archive(f /tmp/etc.tar.gz) to the /backup-test directory.
Create /backup-test directory and cd to /backup-test.
[root@rhel6 /]# mkdir /backup-test [root@rhel6 /]# cd /backup-test [root@rhel6 backup-test]# pwd /backup-test
Extract(x) and view(v) all files from a gzip-compressed(z) archive(f /tmp/etc.tar.gz) to the /backup-test directory.
[root@rhel6 backup-test]# tar xvzf /tmp/etc.tar.gz
List the extracted directory ;
[root@rhel6 backup-test]# ls etcSign up for the WP Engine affiliate program and receive a minimum of $150 per referral! As always if you need any help you can reach us on twitter @ehowstuff or drop us a comment below. Jumping through archives page to read more articles..