LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   extract tar.gz file in other directories (https://www.linuxquestions.org/questions/linux-newbie-8/extract-tar-gz-file-in-other-directories-814209/)

shifter 06-15-2010 03:54 AM

extract tar.gz file in other directories
 
I stay in /var/www/upload and I want extract a file with tar command.

The output of tar xfvz /var/www/file.tar.gz is

Quote:

tar: /var/www/esempio.tar.bz2: funzione "open" non riuscita: Nessun file o directory
tar: Errore irrimediabile: uscita immediata
tar: Child returned status 2
tar: Uscita con stato di fallimento in base agli errori precedenti
Where is the problem?

tracertong 06-15-2010 04:02 AM

My Italian isn't great, but doesn't that just say 'no such file or directory'? The path looks to be wrong. The file you talk of is a .gz, but the error you show is for a .bz2

Try using tab-completion when entering long paths to files, that's what I do. it helps eliminate typos.

centosboy 06-15-2010 04:03 AM

Quote:

Originally Posted by shifter (Post 4003952)
I stay in /var/www/upload and I want extract a file with tar command.

The output of tar xfvz /var/www/file.tar.gz is



Where is the problem?

Code:

"tar: / var/www/esempio.tar.bz2: function "open" failed: No such file or directory tar: Error irretrievable: immediate exit tar: Child Returned status 2 tar: Output with bankrupt according to previous errors"
shouldnt this be

tar xvfj /var/www/upload/esempio.tar.bz2 ??

or are you saying you want to extract the zip file to /var/www/

centosboy 06-15-2010 04:07 AM

Quote:

Originally Posted by centosboy (Post 4003963)
Code:

"tar: / var/www/esempio.tar.bz2: function "open" failed: No such file or directory tar: Error irretrievable: immediate exit tar: Child Returned status 2 tar: Output with bankrupt according to previous errors"
shouldnt this be

tar xvfz /var/www/upload/esempio.tar.bz2 ??

or are you saying you want to extract the zip file to /var/www/



If you want to extract tar file to another directory, then

Code:

tar xvfz file.tar.gz -C /new/directory

colucix 06-15-2010 04:09 AM

Code:

tar: /var/www/esempio.tar.bz2: funzione "open" non riuscita: Nessun file o directory
Actually you tried to extract a bzip2 file, that most likely does not exist. Furthermore the -z option of tar is specific for gzip files, whereas -j manages bzip2. Anyway, GNU tar can manage both the compression methods without specifying any of the two options: it guesses the right method from the file type.


All times are GMT -5. The time now is 12:30 AM.