Different methods to Upload files using command line

With the command line tool, you can upload files to your server via different methods ranging from Scp, Rsync or through SFTP.

As part of our Server Support Services here at Ibmi Media, we have helped customers with different file uploading methods to their servers.

This context will show you the methods to apply when uploading files to the server via SFTP, Scp amd Rsync.

How to upload files to Server via the command line?

Many Linux users find it difficult to upload files to their server. The advantage of uploading files via the command line as you will be able to upload to a specific directory on the server just as you want.

i. Via Rsync

Rsync means copy and it is a great command line tool command to copy files and directories from within the server locally or remotely. It is very flexible to use and have the capability to copy large files from one server to another.

Where do you use Rsync command?

1. In restoring files to the server.
2. When Mirroring.
3. Backups processes.

Rsync syntax is given below;

rsync -avz source/file/path example@publicIP:/home/file

In the process of using Rsync, users might face some issues such as getting stuck when copying or transferring large files from one server to another.
This could be as a result of insufficient memory or Ram exhausted. Therefore it is good to free the memory when doing Rsync operations.
You can use useful Linux commands such as free -m, top -c , vmstat -s, cat /proc/meminfo  to inspect the disk space of the affected server.

ii. Using SFTP

SSH File Transfer Protocol (SFTP) is great file transfer means as it is very secure running over the SSH protocol. Tools such as FileZilla and WinSCP is good for connecting to your server and transferring files to and from the server.

iii. Via Scp

Scp allows files upload to be done with the command line between one server and another via the SSH protocol. It is available by default on most Linux distribution.
Its syntax is given below;

scp -r /path/to/my/files root@

Windows also have their SCP and sftp versions which can be installed if it meets the requirement.

Need support in setting up your Server or managing file uploads? We can help you.


How to use different methods such as Rsync, Scp, and  SFTP to upload files to the server.