LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-11-2015, 06:39 PM   #1
Simon_zhu
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Rep: Reputation: Disabled
Trying to append file to tar archive returns error “Cannot stat: No such file or dire


Just started using Linux and practicing using different commands, as a learning exercise I was trying to append a file to a tar archive that I created named "test.tar" using this command:

tar rvf test.tar newfile

Which returned the error:

tar: newfile: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

I also tried:

tar -rvf test.tar newfile

Which returned the same result.
 
Old 06-11-2015, 06:45 PM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 430

Rep: Reputation: 184Reputation: 184
what happens when you do ls?
It sounds like the newfile isn't in the directory. Change to the correct directory and try again?
The command works fine for me - but outputs the same error when I changed directories.

Last edited by Sefyir; 06-11-2015 at 06:47 PM.
 
Old 06-11-2015, 06:49 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,029
Blog Entries: 1

Rep: Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114Reputation: 2114
Then I would say that the file newfile does not exist in the current directory.

Does it? If so, what does ls -l say within the current working directory?
 
Old 06-12-2015, 12:02 AM   #4
Simon_zhu
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
Facepalm... I was following the examples at this link: http://www.thegeekstuff.com/2010/04/...mand-examples/
And in example number eight I was given the impression that the command would create and append an empty 'newfile' to the tar archive. I didn't realize the file had to actually exist first... thanks for answering my stupid question guys lol
 
  


Reply

Tags
command line, tar


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
[SOLVED] tar.gz: Cannot stat: No such file or directory windstory Linux - Newbie 2 09-07-2011 09:40 AM
How to append tar file ust Linux - Newbie 2 05-20-2009 07:00 AM
Piping tar bzcat to add a file to a tar.bz2 archive DaveQB Linux - Software 0 06-02-2008 09:28 PM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 01:35 AM
tar append file juno Linux - General 5 10-24-2002 03:59 AM


All times are GMT -5. The time now is 05:42 PM.

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