Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

untar filename.tr.gz to directory "filename"

Tags:

shell

tar

I would like to untar an archive e.g. "tar123.tar.gz" to directory /myunzip/tar123/" using a shell command.

tar -xf tar123.tar.gz will decompress the files but in the same directory as where I'm working in.

If the filename would be "tar233.tar.gz" I want it to be decompressed to /myunzip/tar233.tar.gz" so destination directory would be based on the filename.

Does anyone know if the tar command can do this?

like image 529
Jorre Avatar asked Jun 01 '10 14:06

Jorre


People also ask

How do I untar a .gz file?

Simply right-click the item you want to compress, mouseover compress, and choose tar. gz. You can also right-click a tar. gz file, mouseover extract, and select an option to unpack the archive.


1 Answers

tar -xzvf filename.tar.gz -C destination_directory 
like image 196
Jorg B Jorge Avatar answered Oct 18 '22 08:10

Jorg B Jorge