How to Copy a ZIP File in Linux
In this article
Copying a ZIP file in Linux makes a separate copy in another folder, on another drive, or on a remote system. The archive stays compressed; copying it does not extract or change its contents. You can use the graphical file manager or the terminal. For terminal instructions, you will need to know the ZIP file’s current location and where you want the copy to go.
What You'll Need
- A ZIP file you can access, and permission to read it.
- A destination folder with enough free space and permission to write to it.
- For the command-line method, a terminal. The standard
cpcommand is included with most Linux distributions.
Step-by-Step
- Find the ZIP file and destination. In your file manager, locate the archive and the folder where you want its copy. In a terminal, you can list files in the current directory with
ls, or check your location withpwd. A path such as/home/ana/Downloads/backup.zipidentifies a file;/home/ana/Documents/identifies a destination directory. - Choose a copying method. Use the file manager for a visual, straightforward copy, or use
cpwhen you want to specify paths precisely or copy from a terminal. Both methods copy the archive as it is; neither extracts it. - Copy it in the file manager, if preferred. Select the ZIP file and press
Ctrl+C(or right-click and choose Copy). Open the destination folder and pressCtrl+V(or right-click and choose Paste). Wait for the copy operation to finish, especially if the archive is large or the destination is an external drive. - Or copy it with
cp. Open a terminal and run a command with the source path followed by the destination path. For example:cp /home/ana/Downloads/backup.zip /home/ana/Documents/
This places a copy namedbackup.zipinDocuments. Replace both example paths with the actual paths on your system. If the destination is a different directory, it must already exist. - Quote paths containing spaces. Put each full path in quotation marks if a file or folder name contains spaces. For example:
cp "/home/ana/Downloads/Project backup.zip" "/home/ana/Archive Files/"
Alternatively, escape each space with a backslash, such asProject\ backup.zip. Quoting the path is usually easier and avoids the shell treating spaces as separators. - Copy and rename the archive in one command, if needed. Give
cpthe destination filename instead of only a directory:cp /home/ana/Downloads/backup.zip /home/ana/Documents/backup-copy.zip
The original remains in place. Make sure the new name is the one you intend, including the.zipextension if you want it to remain clear that it is an archive. - Handle an existing file deliberately. If a file with the same name already exists at the destination,
cpnormally replaces it without asking. To request a prompt before overwriting, use:cp -i /home/ana/Downloads/backup.zip /home/ana/Documents/
Read the prompt carefully before answering. Choose a different destination name if you want to keep both files. - Verify the copy. Check that the file appears in the destination with
ls -l /home/ana/Documents/backup.zip, adjusting the path as needed. Compare file sizes with the original, or usecmpto check that both files have identical contents:cmp /home/ana/Downloads/backup.zip /home/ana/Documents/backup.zip
No output fromcmpmeans the files match. If you also want to check that the archive itself is readable, rununzip -t /home/ana/Documents/backup.zip; this tests the ZIP archive but does not extract it.
Common Mistakes
- Reversing the paths: The order is source first, destination second:
cp SOURCE DESTINATION. Reversing them may produce an error or copy the wrong file. - Leaving out quotes around spaces: Without quotes, the shell can interpret one path as multiple arguments. Quote the complete path, not just the part after the space.
- Assuming a missing folder will be created:
cpcopies a file into an existing directory; it does not create a missing destination folder. Create the folder first withmkdir -p /path/to/folder, then copy the file. - Overwriting a valuable archive: A same-named destination file may be replaced. Use
cp -ior choose a new filename when you are unsure. - Using
sudounnecessarily: Running a copy as an administrator can create a file owned by root and can hide a permissions problem. Use elevated privileges only when you understand why the destination requires them. - Confusing copying with extracting: To unpack a ZIP, use an archive tool or a command such as
unzip file.zip. To make another copy of the ZIP, usecpor the file manager’s copy-and-paste commands.
Tips
- Type the first few characters of a path and press
Tabto complete a filename. This can help avoid typing mistakes. - To copy a ZIP into the current directory, use
cp /path/to/file.zip .. The dot means “the current directory.” - For a large copy,
cp -v source.zip destination/prints the name as it copies. It is useful for confirmation, but it does not provide a progress bar. - When copying to a USB drive, wait for the operation to finish before ejecting the drive. Use the desktop’s safe-eject option so pending writes can complete.
- If you need to preserve file timestamps and permissions as well as copy the file, consider
cp -p source.zip destination/. For a normal ZIP copy, the basiccpcommand is sufficient.
Troubleshooting
“No such file or directory”: Check the source and destination paths for spelling, capitalization, and missing folders. Linux filenames are case-sensitive: Backup.zip and backup.zip are different names. Use ls to inspect each parent directory.
“Permission denied”: Confirm that your account can read the source and write to the destination. Try a folder you own, such as your home directory. For an external drive, check that it is mounted and writable. Do not use sudo automatically; first identify which path is refusing access.
The copy is larger or smaller than expected, or seems incomplete: Wait for the file manager to finish, then compare sizes or run cmp. If the drive ran out of space or was disconnected, reconnect it and copy again. Check available space with df -h.
The destination file was overwritten: If the previous file matters, stop writing to that location and check your backups or version history. Linux does not normally keep an automatic copy of a file replaced by cp. For future copies, use cp -i or a distinct filename.
The ZIP copy fails its integrity test: Run unzip -t /path/to/file.zip. If the test reports errors, compare the source and destination and copy again from a known-good original. A successful copy preserves the archive’s bytes; it cannot repair an archive that was already damaged.
Frequently Asked Questions
Does copying a ZIP file extract it?
No. Copying makes another compressed archive file. Use an extraction tool separately if you need the files inside it.
What is the basic Linux command to copy a ZIP file?
Use cp source.zip destination/, replacing the example names with the actual source and destination. The source comes first.
Can I copy a ZIP file to a USB drive?
Yes. Make sure the drive is mounted, writable, and has enough free space. Copy the file to the drive’s mounted folder, then safely eject it after the copy finishes.
How do I copy a ZIP file and give it a new name?
Specify the new filename as the destination, for example cp backup.zip backup-copy.zip. The original is not renamed or removed.
Can I copy a ZIP file without opening a terminal?
Yes. Select the file in your graphical file manager, choose Copy, open the destination, and choose Paste. Wait for the file manager to report that the operation is complete.
How can I tell whether the copied ZIP is valid?
Run unzip -t /path/to/copied-file.zip to test the archive. Use cmp with the original and copy if you also need to confirm they are byte-for-byte identical.