tar command
One of the oldest and most frequent used commands for backing up and archiving files is the tar command. Due to its ease and simplicity of use, tar becomes the most general format for tape and disk archives in the present day.
One of the best characteristics of tar is the flexibility to save any medium, because it treats file and tape (or other backup media) device targets the similar.
The tar command helps to backup multiple or single files in a directory hierarchy.
The format of the tar command is as follows
# tar options [ argument ] (tar filename ....) (files to backup or restore)
Options
c - To Creates a new archive; writing starts at the Starting of the archive, and not after the last file.
t - The names of the specified files are listed every time in which they occur on the archive. If no files argument is provided, all the names on the archive are listed.
v - Generally, tar does its work silently. The v (verbose) function modifier causes tar to show the name of every file it treats, proceeded through the function letter. Within the t function, v provides more information about the archive entries than just the name.
F - Causes tar to use the next argument as the name of the archive alter of the default device listed in /etc/default/tar. tar writes to the standard output or reads from the standard input, whichever is appropriate if the name of the file is a dash (-). Therefore, tar can be used as the head or tail of a pipeline. tar could also be used as archive file or device F (default /dev/rmt0) used to move hierarchies within the command:
cd fromdir; tar cf - . | (cd todir; tar xf -)
x - The x named files is extracted from the archive. This directory is (recursively) extracted if the named file matches a directory whose contents had been written onto the archive. The owner, modification time, and mode are restored if possible. If no files argument is provided, the whole contents of the archive are extracted. If various files with the similar name are on the archive, the last one overwrites all previous ones. There is no way to ask for the nth occurrence of a file.
t - The names of the specified files are listed every time in which they occur on the archive. All the names on the archive are listed if no files argument is provided.
r - The named files are written to the end of an existing archive. r function letter is only valid for appending files to disk archives. Whenever specifying the absolute path of an archive device with the function modifier, use the n function modifier to denote that the device is not a magnetic tape. This function letter cannot be used within tape devices. The tar command is unaware of the file systems; moreover if a directory is specified as a tar argument, it copies the whole hierarchy below a directory. It Use a. / in front of the directory name so in which it can be restored relative to a current working directory.