3 Ways to Transfer Files from Linux Server to Local Machine

Here we want to discuss 3 Free ways to Transfer Files from a Linux Server to a Local Machine which include using the SCP, Rsync, and SFTP Tools. There are many ways that you can transfer your files from a Linux server to a local machine. You can follow the steps below to see how you can use these useful tools to do this.

3 Free Ways to Transfer Files from Linux Server to Local Machine

To complete this guide, you must have access to your Linux server as a root or non-root user with sudo privileges. Also, you must have SSH installed on both servers. For this purpose, you can visit the Orcacore website and search for the SSH installation guides on Linux.

Then, follow the steps below to see how you can transfer your files.

Method 1 – Use SCP in Linux for Transfering Files

The SCP must be installed by default on Linux servers. The syntax to transfer files with SCP to a local machine is as follows:

scp <option> <remote username>@<IP address or local hostname>:<file path to transfer> <local file location>

For example:

scp remoteuser@10.0.0.8:/remote/source_file.txt /path/to/local/directory

This will transfer the source_file.txt to the defined local directory.

Also, you can transfer files recursively by using the -r option. This will transfer the entire directory. For example:

scp -r remoteuser@10.0.0.8:remote/ /path/to/local/directory

Note: To get more information about SCP, you can visit this guide on Using SCP to Transfer Files with SSH keys.

Method 2 – Use Rsync in Linux to Transfer Files to Local Machine

The Rsync command must be installed by default on Linux distros. The syntax of this command to transfer files to a local machine is like the following:

rsync <option> <remote user]@[remote IP address or remote hostname>:<source directory> <destination directory>

You can transfer only files with Rsync. For example:

rsync remoteuser@10.0.0.8:remote/* /path/to/local/directory/

The option slash / after the remote directory means to transfer only its contents. The * option means sending every file.

Also, you can recursively transfer files with rsync. For example:

rsync -r remoteuser@10.0.0.8:remote/ /path/to/local/directory

This will transfer the entire remote directory.

Method 3 – Use SFTP For Transfering Files

Also, the SFTP tool is installed default on Linux distros. The syntax is like:

sftp> get <option> <remote file> <local destination>

To transfer files, log in to your Remote server and use Sftp to download the files.

For example:

sftp remoteuser@10.0.0.8
sftp> get remote/source_file.txt /path/to/local/directory

Also, you can recursively transfer files by using the -r option, and -P maintains the file permissions and access times.

sftp remoteuser@10.0.0.8
sftp> get -Pr remote/ /path/to/local/directory

Conclusion

At this point, you have learned 3 Ways to Transfer Files from a Linux Server to a Local Machine which include using the SCP, Rsync, and SFTP Tool. These are the most useful tools that you can use to transfer your files. Hope you enjoy it.

You may be interested in these articles:

Pass password to scp command in Linux using sshpass example

ProFTPD Setup Guide on Debian 12 Bookworm

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!