As we know that
scp is a command for secure copy, it copies files between hosts.
Generally, we follow the below two examples to copy a file from/to localhost to/from a remote machine:
scp /path/to/filename [email protected]:/path/to/destination/directory/ scp [email protected]:/path/to/filename /path/to/local/directory/
These commands and their deformations usually work fine. But when I tried to scp a file to my VPS this afternoon, a problem arose:
scp file\:name [email protected]: ssh: Could not resolve hostname example: Name or service not known
I Googled this problem for quite a while and finally found out that the culprit was the colon in the file name. The solution to this problem turns out to be very simple: