How To: Copy a file to a FTP server from the command line

A nice, easy way to upload files to FTP servers is via some graphical client like FileZilla, but should issues occur or you need to transfer the file without a GUI, then can also upload files via scp like this:

For example, if I want to upload a file proving bigfoot exists (in the imaginatively named file: bigfoot_exists.mp4) to the domain example.com on port 1234 to the user (on that site) somefool in their home directory (i.e. ~), then I’d use:

Job done.

Addendum – Copy from server to local

$ scp -P 1234 remote_host_username@remotehost.foo:some_file.txt /some/local/directory

For example, if remotehost.foo’s ssh daemon operates on port 1234, I could copy php.ini from /srv/ftp to the “bar” directory in my local user’s home directory as follows:

Leave a Reply

Your email address will not be published.