Copying a file in Linux: These options are available

by Mike

There are several methods available for copying a file in Linux. These depend on the version you are using

Copying a file in Linux with a desktop environment: Instructions

Copying files with Linux is not always immediately understandable after switching to a free operating system. If you are using a version with a desktop environment such as Mint, Ubuntu or GNOME, the copying process is usually the same as for other operating systems.

  • Select the desired file with a right-click using the installed file manager, for example Nautilus. A drop-down menu opens.
  • In the drop-down menu you will find the option Copy or Copy. Confirm this.
  • Then change to the target directory. Right-click in the directory to open the drop-down menu again.
  • Confirm the process with Paste or Insert. The file is now copied to the directory. This method can be used with many Linux versions below
  • Note: Alternatively, some desktop environments even support simple drag & drop. To do this, drag the file to the target directory by holding down the left mouse button.

Linux: Copy files via cp command

Of course, you can copy one or more files in Linux using terminal commands. To do this, open the terminal using the key combination [Ctrl] + [Alt] + [T].

  • Thecp command is the standard for copying files in Linux. To do this, enter cp [file] [target directory] in the terminal. Of course, leave out the brackets.
  • You must enter the file name including the file extension, for example readme.txt. This is followed by the file path of the target folder in full, such as home/username/documents.
  • The command would end up as follows: cp readme.text home/username/documents. The file is copied after the command is executed.
  • If you want to copy a directory, specify the directory instead of a file. This can look like this: cp home/username/downloads/projects home/username/documents. The entire projects directory is then copied to the documents:
  • After the cp you can add options. Via -b
  • (–backup) creates an additional backup, while with -i
  • (–interactive) to confirm the overwriting of another file. The -u (–update) option overwrites the older version of the file to be copied that is already in the directory.

Related Articles

Leave a Comment