eXtropia: the open web technology company
Technology | Support | Tutorials | Development | About Us | Users | Contact Us
Resources
 ::   Tutorials
 ::   Presentations
Perl & CGI tutorials
 ::   Intro to Perl/CGI and HTML Forms
 ::   Intro to Windows Perl
 ::   Intro to Perl 5
 ::   Intro to Perl
 ::   Intro to Perl Taint mode
 ::   Sherlock Holmes and the Case of the Broken CGI Script
 ::   Writing COM Components in Perl

Java tutorials
 ::   Intro to Java
 ::   Cross Browser Java

Misc technical tutorials
 ::   Intro to The Web Application Development Environment
 ::   Introduction to XML
 ::   Intro to Web Design
 ::   Intro to Web Security
 ::   Databases for Web Developers
 ::   UNIX for Web Developers
 ::   Intro to Adobe Photoshop
 ::   Web Programming 101
 ::   Introduction to Microsoft DNA

Misc non-technical tutorials
 ::   Misc Technopreneurship Docs
 ::   What is a Webmaster?
 ::   What is the open source business model?
 ::   Technical writing
 ::   Small and mid-sized businesses on the Web

Offsite tutorials
 ::   ISAPI Perl Primer
 ::   Serving up web server basics
 ::   Introduction to Java (Parts 1 and 2) in Slovak

 

Introduction to UNIX for Web Developers
Compression and Archiving  
Before we conclude this tutorial, there is one final subject that you should know about. This is compression/ archiving. UNIX provide several good tools for compressing and archiving your files so that you can create backups of important files or so that you can easily transfer large directory structures from one site to another. Though there are several good utilities for these purposes, two utilities have become the standard for web developers; partly because of their functionality and partly because they work cross-platform. That is, what is compressed and archived on unix can be decompressed and de-archived on Windows or Mac using such applications as WinZip or MacTar.

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

Option Explanation
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:

[Spacer]
[tar]

[Spacer]
"compress" and "uncompress", on the other hand, are common utilities used for compressing files. They are particularly useful when used in combination with tar because once you tar an archive, you can compress the tar file which makes it much more portable (perhaps via ftp).

Take a look at the following example in which we use compress to shrink a TAR file:

Previous | Table of Contents