untar filename.tr.gz to directory "filename"

Posted by Jorre on Stack Overflow See other posts from Stack Overflow or by Jorre
Published on 2010-06-01T14:16:49Z Indexed on 2010/06/01 14:23 UTC
Read the original article Hit count: 354

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about shell-scripting

Related posts about tar