How does Linux cp command determine the source and destination locations in command?
When you run the following cp command in the BASH terminal, how does Linux know which files are the source and which are the destination when copying multiple files from one location to another?
Example: cp /etc/services /etc/motd /etc/fstab /etc/hosts /home/fred/my_dir How does Linux know that the services, motd, fstab, and hosts files are the source and the /home/fred/my_dir is the destination? This question came up in a Linux class and I was not sure of the answer. I was thinking it is based on the source path entered ending with a file path and the destination being a directory, but was not sure. Thank you. |
Because that's how it was coded. There can be only one destination.
Code:
CP(1) User Commands CP(1) |
Quote:
Just a side note, you can also copy multiple directories into one target directory. for example: Code:
cp -r /etc /home /mnt/backup |
Quote:
|
Thanks
Thanks for the quick reply.
That is what I thought but I just wanted to confirm it. |
All times are GMT -5. The time now is 06:57 AM. |