On Wed, Apr 7, 2010 at 3:58 PM, Sergey Poznyakoff <[email protected]> wrote: > Peng Yu <[email protected]> ha escrit: > >> tar xvf something.tar >> >> The above command by default extract the files to the current >> directory. How to extract it to some other directory > > Either: > > cd somedir; tar xvf /path/to/something.tar > > or: > > tar -C somedir -xvf /path/to/something.tar > >> (if the directory doesn't exist, then create a new one)? > > test -d somedir || mkdir somedir; ... > > where `...' stands for one of above commands. > >> Is there an option for this? > > Nope, tar is not supposed to replace shell functionality in any way.
unzip has the option -d. I think that it would be convenient if tar provides a similar option. -- Regards, Peng
