Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I am not able to uncompress a file with .tar.gz extension
sudo tar -xvzf ~/Downloads/file.tar.gz /opt/ but no success.
sudo tar -xvzf ~/Downloads/file.tar.gz /opt/
tar: /opt: Not found in archive
tar: Exiting with failure status due to previous errors
You can specify in which directory you want the files extracted using the -C option. Change your command to:
sudo tar -xvzf ~/Downloads/file.tar.gz -C /opt/
Your are telling tar to look for /opt/ inside the tar file and to extract only that and since it is not in that tar file it throws an error. Do:
sudo cp ~/Downloads/file.tar.gz .
sudo tar -xvzf file.tar.gz
Required, but never shown