In OS X, double click X.tgz
will generate a folder namedX
, putting all files into the folder (the folder name follows the .tgz
file's name).
I want to do the same thing in the terminal.
However, tar -xvzf /pathtofile/X.tgz
will extract all files and put them in /pathtofile/
.
And by tar -xvzf /pathtofile/X.tgz -C /newpath/
the newpath does not automatically follows the .tgz file name(i.e. in this case a folder named "X").
Does anyone know if there is a simple way to do this?