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:
1
|
|
In this exmaple you want to move the file named “file1” from /tmp to /root”:
1
|
|
Rename the file you are copying
If you want to rename the file you’re copying during the copy process use:
1
|
|
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 :)