John1024's answer, does answer the question, however, I would argue that the reasoning is not wholly accurate. It is correct that, by default, the cp
command will not copy directories, however the implication that this is primarily to protect the user from "copying too much" seems unlikely.
Ubuntu operates a Unix-style file system, which uses the concept of inodes
to describe a filesystem
object, be it a file or a directory.
A directory is simply a list of names assigned to inodes
. In that sense, the visual representation provided by the GUI is somewhat of an illusion, i.e. a directory is not actually a 'container' of other files, but rather a list of file names and inode pointers
.
.....a directory entry contains only a name for the associated file and a pointer
to the file itself. This pointer is an integer called the i-number (for index
number) of the file. When the file is accessed, its i-number is used as an index
into a system table (the i-list) stored in a known part of the device on which the
directory resides. The entry found thereby (the file's i-node) contains the
description of the file:...
— The UNIX Time-Sharing System, The Bell System Technical Journal, 1978
From this perspective, we can see that copying a directory, would simply copy a list of names and associated inodes
; this would be akin to creating a hard link to the directory. This is (probably) not the user's actual intention when copying a directory. In all likelihood, when copying a directory using the cp
command, a user intends to make a physical copy of the actual data files within.
Therefore, I would argue that using the -r
option when copying directories, makes the command explicit.