We'll look at the tar utility first.
The tar utility is used to archive an entire directory structure into a single file. this single file will contain all of the information in all of the directories. A tar file is easily moved from one site to another because it is a single file. when the tar file gets to the new location, you can unarchive the whole thing and the directory structure will be recreated in the new location. the tar command is executed as follows:
tar [key] [argument] [drive] [options] file_list
Tar has several options. The ones you probably will use are shown below
|key||Specifies the action to take. Keys will be one of the following:
c = creates a new archive or overwrites an existing one
r = appends the files in the file_list to the end of an existing archive.
t = lists the contents of the archive
u = updates the archive with the latest copies of files within the archive.
x = extracts the files from the archive.
|argument||For your uses you will rarely need the argument but it is here if you do.|
|drive||You will never need this option as a web technician. This is mainly used for sysadmins making global backups|
|f||An option that specifies the name to be used for the archive.|
|A||Makes all absolute file names into relative filenames.|
|v||Tells tar to report in verbose mode about its activities|
|w||Tells tar to query you for a "y" or "n" as it takes actions|
Let's look at an example:
Take a look at the following example in which we use compress to shrink a TAR file: