Create tarball
The Unix tar command creates an archive of files and directories while preserving directory structure, file permissions and ownership information. This command is ideally suited for creating backups of most types of data. Many open-source and commercial backup applications use the tar command.
The basic syntax of the tar command with some common options for creating a “tarball” and unpacking one, respectively:
tar cvf tarball.tar <input_path> tar xvf tarball.tar
The example below uses tar to copy directory /usr/openv to /usr/openv2
mkdir /usr/openv2 cd /usr/openv du -sk openv tar cvf /usr/openv2/tarball.tar . cd /usr/openv2 tar xvf tarball.tar rm tarball.tar
*by default tar will not follow links > can force it to w/t parameter
In the following example we create a tarball of all *.conf files found in /etc/directory. This can be useful for making a quick backup of your server’s vital configuration files before messing with them.
tar cvf - `find /etc -name "*.conf" -print` > /var/tmp/etc_conf.tar
Popularity: 3% [?]
Related posts:


