You should use the scp command, which allows one to copy files from one system to another using the SSH protocol, rather than the cp command. If your local computer is a Linux or OS X system, then you likely already have scp on the system. If your local computer is a Microsoft Windows system and you are using PuTTY, it also has a command line utility, pscp. Or you could use WinSCP, which provides a graphical user interface (GUI).
To copy multiple files at once, you can use an scp command similar to the following one, assuming you wished to copy all html files in the current directory on your local system to a server example.com and store them beneath a directory named public_html on the remote system. The directory path on the remote system will be relative to your home directory on that system. You can also specify your home directory with ~
, e.g. ~/public_html/
. The period at the end indicates you want to give the files the same name on the remote system as they have on the local system.
scp *.html your_remote_username@example.com:public_html/.
See scp or sftp copy mulitple files with single command for other examples of copying mulitple files.
You should run the command outside of your current SSH session. The ssh
command is for interactive logins whereas the scp
, or alternatively, sftp, command is run separately for file transfers.
You don't need to know your local IP address for the command. But, if you want to know your local IP address, you can obtain it by visiting WhatIsMyIP with a browser on your local system. You would only need to know your local IP address to use the scp command if you were copying files in the opposite direction from the remote system to your local system. In that case the local system would also need to be functioning as an SSH server and have appropriate firewall rules configured.