DELAPARRA
Index
Color
NL
Category: CLI commands

cp

Explained by Updated

What is cp?

cp: Copy — Copy files or directories. cp copies files and folders. cp config.example.php config.php copies a file, and cp -r assets backup/ copies a whole folder with everything inside. By default, cp overwrites the destination without asking. cp -i asks first, and cp -n never overwrites. cp -p keeps the original timestamps and permissions, which matters for backups.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about cp

What should you keep in mind with cp?

For anything large or remote, rsync is usually the better tool. It only copies what changed, can resume after an interruption, and shows progress. For quick local backups before editing a config file, cp file file.bak is a good habit. It takes a second and makes it easy to restore the original if the change goes wrong.

At a glance

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.