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 December 08, 2019 alengo / Getty Images Linux Switching from Windows Tweet Share Email The standard method of copying files in Linux uses the cp command. With cp, a duplicate of a file inserts into a specified location. 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. The cp command differs from mv, which moves a file without leaving a duplicate in the original location. Copying 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. Copying 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. 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.