Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
145 views
in Technique[技术] by (71.8m points)

How to extract tar file in Mac terminal

As titled. I want to use some command, like for .zip files I can say

unzip myfiles.zip -d mydirectory

But is there a thing for .tar file on Mac as well?

question from:https://stackoverflow.com/questions/51689294/how-to-extract-tar-file-in-mac-terminal

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Yes, you can run:

tar -xvf myfile.tar

For .tar.gz, you can run:

tar -xzvf myfile.tar.gz

If you want to extract to any directory other than your cwd, use -C. e.g:

tar -xvf myfile.tar -C somedirectory

I suggest you read the man page for tar if you wish to do anything further:

man tar

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...