Extract tar.gz file to a directory and create the directory if not exist
归档分类:教程
Description
I can run the following command to extract the tar.gz file to 'somedir' directory, But this command requires that the directory already exists.
tar -xvf somefile.tar.gz -C somedir
Solution
Following command can extract the somefile.tar.gz file to a directory that does not exist.
tar -xf somefile.tar.gz --one-top-level=somedir