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 on port 1234 to the user (on that site) somefool in their home directory (i.e. ~), then I’d use:

scp -P 1234 ./bigfoot_exists.mp4

Job done.

Addendum – Copy from server to local

$ scp -P 1234 /some/local/directory

For example, if’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:

scp -P 1234 ~/bar/

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.