How to Untar a Unix/Linux file
Unzipping files is an important part of
downloading Linux files from the Internet. In Linux a majority of the files that
are downloaded are in tgz format (a gnu zipped tar file), although there are
other common extensions, as shown here:
[filename].tgz
[filename].tar
[filename].tar.gz
[filename].tar.z
[filename].z
Extraction
First you upload the .tgz, .tar .tar.gz or .tar.z file to the directory on your
web server designated for public Internet use. Typically this directory is named
'www', 'htdocs' or 'web'. The file should be uploaded in BINARY format using any
FTP program.
Always start from the root directory (/).
With files that have the .tgz, tar.gz, or tar.z extension use this command:
tar -zxvf [filename with all extensions]
example: tar -zxvf yourfile.tar.gz
This will extract the file for you in the directory you are currently in. Using
the above command will save you from having to redirect the output for gzip or
anything else (because the z option automatically decompresses the file for
you), otherwise without the z argument, you would have to do a command like
this:
uncompress [filename with all extensions]
tar -xvf [filename with only tar extension]
Other ways to decompress files are to use:
gunzip [filename with .gz extension] - f.e. gunzip yourfile.gz
zcat [filename with .gz extension] - f.e. zcat yourfile.gz
uncompress [filename with .z extension] - f.e. uncompress yourfile.z
Not all Unix systems extract archive files with all the necessary
permissions intact, therefore you should set the proper permissions on the
program as required.
Using Telnet/ssh type the following at the prompt:
chmod -R 777 "directoryname"
cd "directoryname"
chmod 755 cgi-bin
cd cgi-bin
chmod 755 *.cgi
chmod 755 *.pl
You can also use most FTP clients to change the file attributes. 777 (RWX-RWX-RWX)
and 755 (RWX-RX-RX) are the most widely used attributes for files relating to
running most CGI scripts on a server.
(click here to go back to the top)