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

i am not able to copy file in /var/www with sudo cp /home/index.html /var/www

the error is

cp:omitting directory '/home/index.html'

then i used -r, sudo cp -r /home/index.html /var/www, then the error is

cp: cannot overwrite non-directory '/var/www/index.html' with directory '/home/index.html'
share|improve this question
Is /home/index.html a file or folder? I'm not sure, but your error message make it looks like it is a folder, but it should be a regular file. – iBelieve Jan 22 '13 at 18:24

Judging by the error message, /home/index.html is a directory (folder), not a file, and /var/www/index.html already exists and it is a regular file.

To see if /home/index.html is a directory, try:

file /home/index.html

It will probably say: /home/index.html: directory.

If that's the case, you cannot copy a directory over file. Maybe the file you're trying to copy is inside the directory /home/index.html? Then the command would be something like

sudo cp -r /home/index.html/index.html /var/www
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.