Online Linux Terminal Logo
OnlineLinuxTerminal
Opérations sur les fichiersCLI Manual

$cp

Copy files and directories to a destination path.

Syntaxe de la commandePOSIX Standard
cp [OPTIONS] SOURCE... DEST
Communauté Linux2.4k En ligne

Échangez avec des utilisateurs Linux, apprenez des commandes et téléchargez des PDF.

Essayer en direct dans le bac à sable interactif

Simulation côté client sans installation avec retour instantané.

Ouvrir dans le terminal plein écran ↗
bash — terminal

Aperçu et fonctionnement

`cp` (Copy) duplicates files or folders from a source to a destination. It supports copying single files, multiple files into target directories, and recursive directory tree replication with preservation of file modes and timestamps.

Options et drapeaux courants

Flag / OptionDescription
-r, -RCopy directories and their contents recursively.
-pPreserve specified attributes like mode, ownership, and timestamps.
-aArchive mode (same as -dR --preserve=all) for exact backups.
-uCopy only when the SOURCE file is newer than the destination file.
-vVerbose output showing files as they are copied.

Exemples pratiques du monde réel

#1Create a backup copy of a configuration file
cp welcome.txt welcome.txt.bak && ls -l

Duplicates welcome.txt into welcome.txt.bak in the same directory.