$cp
Copy files and directories to a destination path.
cp [OPTIONS] SOURCE... DESTPrueba en vivo en la terminal interactiva
Simulación del lado del cliente sin instalación y con respuesta inmediata.
Descripción general y funcionamiento
`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.
Opciones y banderas comunes
| Flag / Option | Description |
|---|---|
| -r, -R | Copy directories and their contents recursively. |
| -p | Preserve specified attributes like mode, ownership, and timestamps. |
| -a | Archive mode (same as -dR --preserve=all) for exact backups. |
| -u | Copy only when the SOURCE file is newer than the destination file. |
| -v | Verbose output showing files as they are copied. |
Ejemplos prácticos del mundo real
cp welcome.txt welcome.txt.bak && ls -lDuplicates welcome.txt into welcome.txt.bak in the same directory.
Comandos de Linux relacionados
Busque archivos y directorios en una jerarquía según el nombre, tipo, tamaño o fecha de modificación.
Concatene e imprima el contenido de archivos en la salida estándar.
Create new directories and folder hierarchies.
Remove files or directories from the filesystem.
Move or rename files and directories.
Create empty files or update file access and modification timestamps.