Why compressed directories cannot be extracted in /opt?
23,822
Solution 1
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/
Solution 2
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:
cd /opt
sudo cp ~/Downloads/file.tar.gz .
sudo tar -xvzf file.tar.gz
Solution 3
use --directory
before the directory path at which you would like to extract:
sudo tar -xvzf ~/Downloads/file.tar.gz --directory /opt/
Related videos on Youtube
Author by
Chirag
Updated on September 18, 2022Comments
-
Chirag over 1 year
I am not able to uncompress a file with .tar.gz extension
Did
sudo tar -xvzf ~/Downloads/file.tar.gz /opt/
but no success. it says:tar: /opt: Not found in archive tar: Exiting with failure status due to previous errors