Wednesday, August 6, 2008

Untar a Unix / Linux file

Oracle Certification Program Candidate Guide

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:



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.

Once the installation file has been uploaded, connect to your web server using a terminal emulation program. One of the most popular of these programs is Telnet. Enter your username and password when prompted, then change to the directory on your web server designated for Internet use. If this directory is named 'www', you should type the following command at the prompt:

cd /usr/dom/www
or cd /home/sites/me/web

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]

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 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.

No comments:


My Blog List