PDF download Download Article
Copy and paste a file in Linux with this handy guide
PDF download Download Article

This wikiHow teaches you how to copy and paste a file on a Linux computer. The command line can be used to copy and paste files, or you can use the keyboard shortcuts or your computer's right-click function if you're using a version of Linux that has a user interface.

Things You Should Know

  • Open the Terminal by pressing Alt + Ctrl + T on most Linux versions.
  • Type in cd path where "path" is the address of the folder in which the file you want to copy is located.
  • Type the "copy" tag cp followed by a file's name and extension.
Method 1
Method 1 of 2:

Using the Command Line

PDF download Download Article
  1. Click or double-click the Terminal app icon, which usually resembles a black box with a white ">_" on it.
    • You can also just press Alt + Ctrl + T to open Terminal on most Linux versions.
  2. Type in cd path where "path" is the address of the folder in which the file you want to copy is located, then press Enter .
    • For example, to tell Terminal to look for your file in the Desktop folder, you would type cd Desktop into Terminal.
    • Make sure you capitalize the folder's name if necessary.
    • If attempting to switch to a folder results in an error, you'll need to enter the folder's entire path (e.g., /home/name/Desktop/folder instead of just folder ) here.
    Advertisement
  3. This tag is cp with a space after it.
  4. Type in the name and extension of the file you want to copy after cp and the space, then add a space.
    • For example, if you want to copy a file named "hello", you would type cp hello into Terminal.
    • If the file name has an extension on the end of it (e.g., ".desktop"), make sure you include the extension in the file's name when typing it into Terminal.
  5. Type in the path for the folder into which you want to copy the file.
    • For example, if you want to copy "hello" into a folder named "Hi" that's stored in the Documents folder, you would have cp hello /home/name/Documents/Hi (where "name" is your username) typed into Terminal.
  6. Doing so will run your command. Your file will be pasted into the folder you specified.
  7. Advertisement
Method 2
Method 2 of 2:

Using the Interface

PDF download Download Article
  1. As with virtually all operating systems that have user interfaces, you can use keyboard shortcuts to copy and paste files on Linux:
    • Click the file you want to copy to select it, or drag your mouse across multiple files to select them all.
    • Press Ctrl + C to copy the files.
    • Go to the folder into which you want to copy the files.
    • Press Ctrl + V to paste in the files.
  2. Go to the location in which the file is located.
  3. Click once the file to do so.
  4. Doing so will prompt a drop-down menu.
    • Some Linux versions will also display a menu bar at the top of the screen. If so, you can click Edit instead of right-clicking the selected file.
  5. It's in the drop-down menu. This copies the selected file.
    • You may click Copy... or Copy File on some versions of Linux.
  6. Find the folder into which you want to paste the file.
  7. This will create a drop-down menu in the folder.
  8. It's in the drop-down menu. Doing so pastes in your copied file.
  9. Advertisement

Community Q&A

Search
Add New Question
  • Question
    What option will allow me to copy the contents of /dir1 to /dir2 while preserving the modification times, ownership, and permissions?
    Community Answer
    You can try "-a" for an archive to preserve as much as possible. You can also do "--preserve" followed by a comma-separated list of attributes to preserve (or "--preserve all"). Finally, try "cp --help" or "man cp" for more options.
Ask a Question
      Advertisement

      Video

      Tips

      • If you want to move a file to a different folder rather than copying the file, you can type mv instead of cp when specifying the file's name and its destination (e.g., mv hello Documents ).
      • Holding down Ctrl while clicking individual files will select each file you click. Right-clicking one of the selected files and selecting Copy will then copy all of the selected files.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      Warnings

      • Not all versions of Linux have a user interface. If your version of Linux has only a command line, you'll need to use the "cp" command to copy your files.
      Advertisement

      About This Article

      Thanks to all authors for creating a page that has been read 233,130 times.

      Is this article up to date?

      Advertisement