To copy a file to a USB drive on Linux, first find where the drive is mounted, then use cp with the file’s path and the USB mount point. For example, if the drive is mounted at /media/alex/BACKUP, run cp "$HOME/Documents/report.pdf" "/media/alex/BACKUP/".
Find the USB drive and its mount point
Most desktop Linux systems mount a USB drive automatically after you plug it in. The file manager may show it in the sidebar, and its mounted folder is often under /media/$USER/ or, on some systems, /run/media/$USER/. The exact location depends on the distribution, desktop environment, drive label, and system configuration, so treat these as common patterns rather than fixed paths.
To inspect connected storage from the terminal, use:
lsblk -f
Look for the USB drive’s partition and its MOUNTPOINTS column. A USB device may appear as /dev/sdb, with a partition such as /dev/sdb1, but device names can change between computers or connections. Do not assume that a particular letter always refers to the USB drive. The mount point is the directory where you access the drive’s files; it is not the same thing as the device name.
You can also check mounted filesystems with findmnt. To see available space at a known path, run df -h "/media/alex/BACKUP", replacing the example path with the one shown on your system. If the mount point contains spaces, quote the entire path.
Copy one file with cp
The basic syntax is cp SOURCE DESTINATION. If the destination is a mounted USB folder, specify that folder as the destination. For example:
cp "$HOME/Documents/report.pdf" "/media/alex/BACKUP/"
This puts report.pdf inside the USB drive’s top-level folder. To give the copy a different name, include the new filename in the destination:
cp "$HOME/Documents/report.pdf" "/media/alex/BACKUP/report-final.pdf"
Quotes protect paths containing spaces, such as My Documents or a drive label like Travel USB. Quoting the source and destination consistently is a good habit even when a particular path has no spaces. The -- option can protect against a filename that begins with a hyphen being interpreted as a command option:
cp -- "-draft.txt" "/media/alex/BACKUP/"
By default, cp usually replaces a same-named destination file without asking. Add -i to be prompted before overwriting, or use -n to avoid overwriting an existing file. Check the options supported by your system’s cp with cp --help.
Copy several files or a directory
List multiple source files before the destination directory. For example, this copies two files to the drive:
cp "$HOME/Documents/notes.txt" "$HOME/Pictures/map.png" "/media/alex/BACKUP/"
To copy a directory and everything inside it, add the recursive option -r:
cp -r "$HOME/Projects/site" "/media/alex/BACKUP/"
The result is a site directory on the USB drive containing the copied directory tree. If you want the contents of a directory copied into an existing destination directory rather than creating a nested folder, make the source and destination paths explicit and check the resulting layout afterward; directory-copy behavior is a frequent source of accidental extra folder levels.
For a general-purpose copy that also attempts to preserve timestamps, permissions, links, and other file attributes, use archive mode:
cp -a "$HOME/Projects/site" "/media/alex/BACKUP/"
Archive mode is useful when copying between Linux filesystems, but a USB drive formatted as FAT32 or exFAT may not represent every Linux ownership, permission, or timestamp detail in the same way. A file copy can still succeed even when those attributes cannot be preserved exactly.
Copy a large file with progress
Ordinary cp does not normally show a percentage or progress bar. For a large file or directory, rsync is a useful alternative because it can display progress and can resume work more effectively when rerun. A common command is:
rsync -avh --progress "$HOME/Videos/event.mp4" "/media/alex/BACKUP/"
The options here enable archive-style copying, human-readable sizes, and progress output. If the command is run again with the same source and destination, rsync checks what needs transferring rather than blindly copying every unchanged file again. This is handy for a folder that changes over time, though it is not a substitute for checking that the destination is the correct drive. On systems without rsync installed, install it using the package manager for that distribution or use cp.
Check that the drive has enough free space before starting. The df -h command reports available space, while du -sh "$HOME/Videos/event.mp4" can show the source’s size. Filesystem limits matter too: FAT32 cannot store a single file larger than 4 GiB, even when the drive has plenty of free space. exFAT and many Linux filesystems support larger files, but compatibility and permissions differ.
If the USB drive is not mounted
If lsblk -f shows a partition but no mount point, the system has detected storage that is not currently accessible through a mounted directory. On a desktop, opening the drive in the file manager may mount it. If you choose to mount it manually, first identify the correct partition and filesystem; do not copy blindly to a device path such as /dev/sdb1. Files are copied to the mounted directory, not written to the partition device as if it were an ordinary folder.
A manual mount might look like this after you have confirmed the partition and created a mount directory:
sudo mkdir -p /mnt/usb
sudo mount /dev/sdX1 /mnt/usb
cp "$HOME/Documents/report.pdf" /mnt/usb/
/dev/sdX1 is a placeholder, not a literal device name to copy and paste. Replace it with the verified partition, such as the actual partition shown by lsblk. Mounting may require administrator privileges, and filesystem support or permissions can affect the command. When finished with a manually mounted drive, unmount it with sudo umount /mnt/usb.
Verify the copy and safely remove the drive
A command returning to the prompt without an error is a useful sign, but it does not prove that you selected the intended destination or that the file is usable. List the copied file with ls -lh "/media/alex/BACKUP/", compare its size with the original, or open it from the USB drive. For important data, compare checksums:
sha256sum "$HOME/Documents/report.pdf" "/media/alex/BACKUP/report.pdf"
If the two printed SHA-256 values match, the files’ contents match. This is more thorough than comparing names or sizes, though it takes time to read a large file from the drive.
Do not unplug a drive while data may still be writing. Use the desktop’s eject or safely-remove option, or unmount the relevant mounted partition from the terminal. For an automatically mounted drive, a command such as udisksctl unmount -b /dev/sdX1 may work on systems using UDisks; replace the placeholder with the confirmed partition. Wait for a successful completion message before removing the device. If using a manually mounted drive, unmount its mount point. Safe removal helps ensure pending writes have finished and reduces the risk of incomplete files or filesystem damage.
Common errors and what they mean
- “No such file or directory”: Check the source path and USB mount point for spelling, capitalization, and spaces. Linux paths are case-sensitive. Use
lsto inspect directories and quote paths with spaces. - “Permission denied”: The destination may not be writable, or the source may require access you do not have. Confirm the drive is mounted read-write and check its permissions. Avoid reflexively running
sudo cp; copying as root can create files with ownership that is inconvenient later and does not fix every filesystem issue. - “No space left on device”: The drive may be full, or a filesystem limit may prevent the file from being stored. Check
df -h; for a file over 4 GiB, confirm the drive is not FAT32. - “Read-only file system”: The drive may be mounted read-only because of filesystem errors, write protection, or mount settings. Do not try to force writes without understanding why; safely unmount it and inspect or repair it as appropriate.
- The copy appears to have stopped: Large files can take time, especially on slower USB devices. Check the process and wait for it to finish instead of unplugging the drive during a transfer.
When to use cp, rsync, or a file manager
Choose cp for a simple one-time copy: its syntax is short, it is available on essentially every Linux installation, and it works well for a few files. Choose rsync when you want visible progress, are copying a large directory, or expect to repeat the transfer and want unchanged files skipped. A graphical file manager is often the easiest option when you do not know the mount path; drag-and-drop also gives a clear view of the drive’s contents. These approaches all copy files through the mounted filesystem, so the key safety steps are the same: identify the destination, allow the transfer to finish, and eject or unmount before unplugging.
Frequently Asked Questions
What is the command to copy a file to a USB drive in Linux?
Use cp source-file mounted-USB-folder/, for example cp "$HOME/file.txt" "/media/alex/USB/". Replace the example paths with the actual source and mount point on your system.
How do I find the USB path in Linux?
Run lsblk -f and look for the USB partition’s mount point. Desktop systems commonly mount drives beneath /media/ or /run/media/, but the exact path varies.
Can I copy a folder to a USB drive with cp?
Yes. Use cp -r folder-name /path/to/usb/ to copy a directory tree. Use cp -a when you also want to preserve as much file metadata as the destination filesystem supports.
Why does Linux say the USB drive is read-only?
The drive may have write protection enabled, be mounted with read-only settings, or have filesystem problems. Check its mount status and filesystem before changing settings; do not unplug it until it has been safely unmounted.
Should I use sudo to copy files to a USB drive?
Usually not. A user-mounted USB drive is generally writable by that user. If permission is denied, check the mount and filesystem permissions first rather than using sudo automatically.
How do I safely remove a USB drive after copying?
Use the desktop’s eject option or unmount the drive’s partition or mount point, then wait for confirmation before unplugging it. This allows pending writes to finish.