← All commands
Topic hub File Management
Windows Linux File Management File System

Windows copy equivalent in Linux

Copies files or entire directory trees to another location.

Windows copy
Linux equivalents
Debian/Ubuntu same command
cp
Fedora same command
cp
Arch same command
cp

Overview

What this command does

Copies files or entire directory trees to another location.

Migration tip: To copy a directory and all its contents, you must use cp -r (recursive). Forgetting -r is one of the most common beginner mistakes.

Practical tasks

Common use cases

Copy files and folders

Copies files or entire directory trees to another location.

cp -r

Copy directories recursively

cp -i

Ask before overwriting (interactive)

cp -v

Verbose — show what's being copied

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

cp file.txt backup.txt
cp file.txt /home/user/docs/
cp -r MyFolder Backup
cp -rv MyFolder /backup/

Walkthrough

Examples with explanations

# Windows: copy file.txt backup.txt
cp file.txt backup.txt          # copy a file
cp file.txt /home/user/docs/   # copy to another directory

# Windows: xcopy /s /e MyFolder Backup
cp -r MyFolder Backup          # copy an entire folder
cp -rv MyFolder /backup/       # copy folder, show progress

Reference

Common options and variations

Command or optionUse
cp -rCopy directories recursively
cp -iAsk before overwriting (interactive)
cp -vVerbose — show what's being copied
cp -pPreserve timestamps and permissions
cp -uOnly copy if source is newer

Distro differences

Debian/Ubuntu vs Fedora vs Arch

This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command cp Same command on this distribution.
Fedora same command cp Same command on this distribution.
Arch same command cp Same command on this distribution.

Important

What to watch out for

cp will silently overwrite existing files by default. Use cp -i to be prompted before overwriting.

Keep learning

Related File Management commands