LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 05: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, 05:45 PM   #2
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
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 05:47 PM.
 
Old 06-11-2015, 05:49 PM   #3
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
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-11-2015, 11:02 PM   #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



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 3 04-14-2020 04:08 AM
How to append tar file ust Linux - Newbie 2 05-20-2009 06:00 AM
Piping tar bzcat to add a file to a tar.bz2 archive DaveQB Linux - Software 0 06-02-2008 08:28 PM
Tar gives error when creating a tar file archive davidas Linux - Newbie 10 04-13-2004 12:35 AM
tar append file juno Linux - General 5 10-24-2002 02:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:24 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
Open Source Consulting | Domain Registration