Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Following command sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/news news is giving "tar: Cann't stat: No such file or directory" error.

How can I solve this problem?

As it had been answered in my previous question I am using -C option in order to skip leading directories. It was working in one Ubuntu server and now in my Ubuntu Desktop it is giving that error message.

share|improve this question
up vote 1 down vote accepted

If you are using -C that means you are changing directory there. Hence, if you want to tar a directory named news in /var/www you must use:

sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/ news
share|improve this answer

Alternatively you can execute your as follows:

(cd /var/www/news ; tar -jcf /datos/backup/news/news.tar.bz2 news)

This should create the archive /datos/backup/news/news.tar.bz2 with the content news. This requires, that the folder /var/www/news/news exists. If you intended to compress the folter /var/www/news only, use instead:

sudo tar jcf -C /var/www /datos/backup/news/news.tar.bz2 news


(cd /var/www ; tar -jcf /datos/backup/news/news.tar.bz2 news)
share|improve this answer

Do you have a news directory inside /var/www/news?

If not you could replace the last news with a . eg.:

sudo tar jcf /datos/backup/news/news.tar.bz2 -C /var/www/news .
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.