

If you have GNU tar installed ( /usr/sfw/bin/gtar), it supports compression directly, as well as path-stripping.
#Tar command unix untar archive#
Assuming the archive was created using one of these two methods or similar, a variant of this second form will allow extraction to an arbitrary location: gzip -dc < | (cd /path/to/extraction/point & tar xvf -) In the Solaris implementation, the -C switch does not apply to extraction. tar xvf grads-2.0.2.

So if you want to be able to extract a second copy of the contents, you will have to create the archive with a slightly different command: tar cvf -C /path/to/directory. Drop the space after -, or even drop -entirely. This is because Solaris tar does not strip leading / from archive entries upon extraction and has no means of stripping path components. You will find that extracting this archive always overwrites the original files. A plain extraction can be achieved through: gzip -dc tar.gz is used to signify this, however tar will fail if something is not right.
UNIX short option style, using a single dash and clustered options: tar -cfvOne such caveat is that it does not support compression by itself. Traditional style, clustered together without any dashes.
#Tar command unix untar how to#
If you are looking for additional helpful solutions, you might want to check out this How to Open Files as Root article.None of the other answers here mention all the caveats of the default tar implementation in Solaris. Hopefully this section has helped you unpack, open, or extract those compressed tar files you downloaded from the internet. NOTE: You can specify a different directory to extract to using the -C parameter and path to the directory as follows: tar -C /myfolder -zxvf file_ If you want to copy the tar file to the remote server and also unpack it, try tar -cf - mydir ssh root192.168.1.248 'bash -c 'tee archive. (replacing file_ with the actual name of your file) 2 Answers Sorted by: 2 Just tarring a directory, copying it to a remote server, where it is untarred Then scp -r directory. To extract the contents of the tar.gz file to the current directory, type the following.

The usual file extension for a compressed tar archive is. tar.gz file is located, cd ~/directory_path In Terminal, you can use the GNU tar command to compress and uncompress files and folders.
