LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   tar -C option at the file system (https://www.linuxquestions.org/questions/linux-software-2/tar-c-option-at-the-file-system-712450/)

Berris.Oliver 03-18-2009 04:30 AM

tar -C option at the file system
 
Here's the syntax I used to untar a particular folder to a directory in the file system:

"tar -C / -tvf /dev/nst0 /media/videos"

Instead of getting a result that the files were written on the file system (because of the '/'), it stores the untarred files to the directory where I issued the command. How can you untar your file to the file system?

jschiwal 03-18-2009 04:41 AM

Your command doesn't extract files, it lists the contents of the tar archive.

kirukan 03-18-2009 05:11 AM

its simple
#tar -xzvf name.tar.gz this will untar in current directory
if you want to untar it in another location
#tar -xzvf name.tar.gx /path/to/directory
actually option "c" using for compress the files and "t" for list the contents inside the tar file
check manpage for more information

jlinkels 03-18-2009 05:58 AM

-C means change working directory (to / in this case). But why do that if you want to tar /media/videos?

If you want to tar /media/videos you can omit -C /

However as jschiwal pointed out, -tvf lists the contents. For creating a tar file, use -cvf

Also you are writing to a tape device which does not rewind at the end of the write operation. Is that intentional?

jlinkels

Interflex 03-18-2009 10:46 AM

as well as this with tar be aware the the - does change how the parameters work. see the man page.

Berris.Oliver 03-18-2009 08:28 PM

tar -C option in the file system
 
Thanks for all your reply. I'm trying to extract files from the tape and would want to place the extracted files to the file system. With your replies, here's the new syntax:

tar -C / -xvpf /dev/nst0 /media/videos

Now the syntax works well! I think it really is with where you place the options before executing the desired command.


All times are GMT -5. The time now is 04:45 PM.