Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Cp (Unix)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Examples == This copies file '''prog.c''' to file '''prog.bak'''. If '''prog.bak''' does not already exist, this creates it. If it does exist, its content will be replaced. cp prog.c prog.bak This copies the files '''jones''' and '''smith''' into the pre-existing directory '''clients'''. cp jones smith clients This copies file '''smith''' to a file named '''smith.jr'''. Instead of creating a file with the current date and time stamp, the command copies the date and time from the original. The copy also receives other metadata from the original including access control protection. cp -p smith smith.jr This reclusively copies the directory '''clients''', including its files, subdirectories, and the files in those subdirectories, to a new directory '''customers/clients'''. cp -R clients customers Some implementations behave differently in recursive mode, depending on the termination of the directory path. Using <code>cp -R clients/ customers</code> in the GNU implementation behaves as above. However, with a BSD implementation, it copies the ''contents'' of the '''clients''' directory, instead of the directory '''clients''' itself. The same happens in both GNU and BSD implementations if the path of the source directory ends in . or .. (with or without trailing slash).
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)