Posted on

How to extract tar file to different folder

Only when the the path of files saved in the tar file is relative can you extract them to different folder.
Check it is relative or not using:

tar tvf /paht/your-tar-file.tgz

If the path is relative,

cd  /your/extract/folder
tar xvzf /path/your-tar-file.tgz

Or just run:

tar xvzf /path/your-tar-file.tgz -C /your/extract/folder


tar xvzf /path/your-tar-file.tgz --directory /your/extract/folder
Leave a Reply

Your email address will not be published. Required fields are marked *