Linux Stuff && Coffee

Linux File Copy Command

| Comments

Linux file copy command

How to copy a file on the Linux / Unix based operating systems from the command line using the cp command (the linux file copy command).

Linux File Copy Command

To copy a file under Linux (or Unix), enter the following command:

cp file /destination/file

In this exmaple you want to move the file named “file1” from /tmp to /root”:

cp /tmp/file1 /root/file1

Rename the file you are copying

If you want to rename the file you’re copying during the copy process use:

cp /tmp/file /root/new-file-name

Note: if you are already in the directory you wish to copy the file from you do not have to specify the whole path.

Drop me a comment below if this article on the Linux file copy command helped you out :)