LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-18-2009, 04:30 AM   #1
Berris.Oliver
LQ Newbie
 
Registered: Feb 2009
Posts: 16

Rep: Reputation: 0
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?
 
Old 03-18-2009, 04:41 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

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

Last edited by jschiwal; 03-18-2009 at 03:11 PM.
 
Old 03-18-2009, 05:11 AM   #3
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,275

Rep: Reputation: 148Reputation: 148
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
 
Old 03-18-2009, 05:58 AM   #4
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 4,959

Rep: Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876Reputation: 876
-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
 
Old 03-18-2009, 10:46 AM   #5
Interflex
Member
 
Registered: Aug 2008
Posts: 52

Rep: Reputation: 15
as well as this with tar be aware the the - does change how the parameters work. see the man page.
 
Old 03-18-2009, 08:28 PM   #6
Berris.Oliver
LQ Newbie
 
Registered: Feb 2009
Posts: 16

Original Poster
Rep: Reputation: 0
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.

Last edited by Berris.Oliver; 03-18-2009 at 09:29 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
'Read-only file system' when untar a tar.bz2 file yinglcs Linux - General 1 02-18-2006 09:12 PM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM
tar file name with system date mnauta Linux - General 4 12-19-2003 04:48 PM
Large tar file taking huge disk space in ext3 file system pcwulf Linux - General 2 10-20-2003 07:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration