-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux cp Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to cp on Linux, covering Arch Linux, CachyOS, and other distributions including copying files, directories, and backup operations.
cp (copy) copies files and directories.
Uses:
- Copy files: Duplicate files
- Backup: Create backups
- Duplicate: Make copies
- File management: Manage files
Why it matters:
- Backup: Create file backups
- Duplication: Copy files
- Organization: Organize files
Basic usage:
# Copy file
cp source.txt destination.txt
# Copy to directory
cp file.txt /path/to/directory/Copy several:
# Copy multiple files
cp file1.txt file2.txt file3.txt /destination/
# All copied to destinationKeep properties:
# Preserve attributes
cp -p source.txt dest.txt
# Keeps:
# - Permissions
# - Timestamps
# - OwnershipConfirm overwrite:
# Interactive mode
cp -i source.txt dest.txt
# Asks before overwritingCopy directory:
# Copy directory
cp -r source/ destination/
# Recursive copyKeep structure:
# Preserve all
cp -a source/ destination/
# -a = archive mode
# Preserves everythingFix permissions:
# Check permissions
ls -l source.txt
# Use sudo if needed
sudo cp source.txt /destination/This guide covered cp usage, file/directory copying, and backup operations for Arch Linux, CachyOS, and other distributions.
- mv Guide - Move/rename files
- rsync Guide - Advanced copying
- Backup and Restore - Backup strategies
-
cp Documentation:
man cp
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.