Software & Apps Linux How to Use Linux to Copy Files and Folders The 'cp' command duplicates files from the shell prompt by Gary Newell Writer Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. our editorial process Gary Newell Updated on February 18, 2021 Tweet Share Email Linux Switching from Windows What to Know Use the cp command in the following format: cp [option] source destination to copy files and folders to another directory. Example: Copy sample.txt from /home/user/docs to /home/user/desktop: cp ~/docs/sample.txt ~/desktop/sample.txt In a Linux desktop environment, right-click and drag the file. Release the mouse and choose copy and move options from the menu. This article explains how to use the Linux cp command to copy files and folders from one directory to another. As with any Linux command, cp supports a variety of switches, and the command runs under the hood when you copy files using a graphical file manager. Copy Files From the Shell Prompt From a shell prompt, use the cp command. It takes the following general form: cp [option] source destination The command accepts a handful of specific options that present as switches. Check the manpage for cp or execute cp --help for a specific context. For example, to copy the file sample.txt from /home/user/docs to /home/user/desktop, execute the following command: cp ~/docs/sample.txt ~/desktop/sample.txt The cp command works with hard and soft links, metacharacters, and wildcards. Copy Files in the Desktop Environment Because Linux offers several robust desktop environments, each DE's default file manager functions slightly differently. In general, though, graphical file managers all support the same conventions. To copy a file, right-click it and drag it; when you release the mouse, you'll see a context menu offering options including copying and moving. This process works for the desktop, as well. Some distributions do not allow files to appear on the desktop. Check your DE's settings to toggle whether files may appear on the desktop. This setting is not generally set in a graphical file manager, but rather in system-level settings, depending on the distribution. 10 Essential Linux Commands for Navigating Your File System What Are Symbolic Links Anyway, and How Can I Create Them? Files that begin with a dot are, by default, hidden from display, although you can copy them even when they're hidden. Press Ctrl+H to view them in a graphical file manager or execute ls -a to display them in a listing within the shell. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit