Reply
Thread Tools
Posts: 4 | Thanked: 0 times | Joined on Mar 2008
#1
Hi,

I've downloaded a .tar.gz file to my external MMC and was wondering how I can unpack it to the same or even another directory.

Been searching for the right command to use in XTerm, but it's proving a bit fruitless.

If my file is called XYZ.tar.gz, what should I be typing in XTerm ?

TIA

HWSRN
 
Posts: 40 | Thanked: 28 times | Joined on Feb 2008
#2
"tar zxvf XYZ.tar.gz" should do the trick.
 
Posts: 187 | Thanked: 23 times | Joined on Aug 2007
#3
I use gunzip filename.tar.gz and then tar -xvf filename.tar

I'm sure there's you can gunzip w/ the tar command but don't know the flag offhand.

Read more @ someplace like
http://unixhelp.ed.ac.uk/CGI/man-cgi?tar
(google search = tar man page)
 
Posts: 4 | Thanked: 0 times | Joined on Mar 2008
#4
Originally Posted by aot View Post
"tar zxvf XYZ.tar.gz" should do the trick.
Great.
Couple of questions.

- Do I need to change directory first or anything ?

- And does that command create its own directory within the existing one ?

- Will I be able to view the contents in File Manager ?


Thanks again.
 
Posts: 157 | Thanked: 96 times | Joined on Nov 2007 @ Oxford, UK
#5
The tar command will always extract the files into the current directory. Usually people create tar files such that all the files are in a top-level folder, and if your file is like that it will simply create a single folder. To check this do "tar ztvf XYZ.tar.gz" and you will get a list of all the files in the tarfile. If they are all in a single folder it should be obvious, otherwise create a new directory, change into it, and then do the extract.
 
Posts: 3,841 | Thanked: 1,079 times | Joined on Nov 2006
#6
Before you unpack the compressed tar file you will probably want to check its content (then you'll quickly see if you want to create a subdirectory first and cd there before you unpack).

Simply use 't' instead of 'x' to list the content: tar tvf file.tar.gz
__________________
N800/OS2007|N900/Maemo5
-- Metalayer-crawler delenda est.
-- Current state: Fed up with everything MeeGo.
 
gnuite's Avatar
Posts: 1,245 | Thanked: 421 times | Joined on Dec 2005
#7
tar's "-C" flag will allow you to untar into a different directory. Technically, it forces tar to "change to directory DIR" before performing the untar (hence the "-C" name), which means it won't create the directory if it doesn't already exist. For example, to untar MyPackage.tar.gz into /tmp:

tar zxf MyPackage.tar.gz -C /tmp
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 15:41.