What is cp: omitting directory error in Linux and how to solve

cp: omitting directory error tells that directories are not copied as the cp command by default works on the files only. Simply, use the cp command with  -r or -R (recursive) as an argument to resolve cp: omitting directory error.

 -R, -r, --recursive
copy directories recursively

The cp command – r or -R (recursive) option, allows you to copy directories/subdirectories recursively.

Let’s reproduce the error

Copy a file from src_file.txt to /home/imaginelinux/dest_dir folder.

cp src_file.txt /home/imaginelinux/dest_dir

This works fine for files.

Now, let’s run the command for the directory and see what happens. Copy a directory from src_dir to desk_dir.

cp src_dir desk_dir
cp: -r not specified; omitting directory 'src_dir'

Now let’s again run the copy command now with the – r option.

cp -r src_dir dest_dir


cp -R src_dir dest_dir

Now you can see the command worked fine and directories along with contents are also copied.


Linux cp command is very useful and powerful. By default, it works on files only. You need to use the -r or -R option to copy directories otherwise, you will get omitting directory error.

Refer to this discussion on Askubuntu and StackOverflow for additional details.

I hope you found this article helpful. Please share and subscribe.

Watch this video tutorial:


Scroll to Top