DEV Community

Samuel John
Samuel John

Posted on

3 2

My favourite rsync commands

Below, i have collated some rsync commands that I use in my day-to-day system administration tasks.
I found rsync a better tool compared with other FTP/SFTP tools that I have used in the past. (FileZilla was my goto tool in the past).

Another thing that fascinated me and attracted me to using rsync was the need to carry out all my sysadmin/development tasks inside one gui using an IDE (I fell in love with VSCode as my favourite).

Now, let's begin:

Rsync command to copy a file/folder from local pc to a remote server

With key/certificate
$ rsync -iav /path/to/keyfile/key.pem /local/directory/path/ user@example.com:/remote/directory/path/

Enter fullscreen mode Exit fullscreen mode
Without key/certificate
$ rsync -iv /local/directory/path/ user@example.com:/remote/directory/path/
Enter fullscreen mode Exit fullscreen mode

Rsync command to copy a file/folder from remote pc/server to a local pc/server

With key/certificate
$ rsync -avzP --rsh=ssh user@example.com:/remote/directory/path/ /local/directory/path/

Enter fullscreen mode Exit fullscreen mode
Without key/certificate
$ rsync -avzP --rsh=ssh user@example.com:/remote/directory/path/ /local/directory/path/
Enter fullscreen mode Exit fullscreen mode

Rsync command to copy a file/folder from remote pc/server to another remote pc/server

$ rsync -i /path/to/keyfile/key.pem user@example.com:/path/to/file.txt user@example.org:/path/to/file

Enter fullscreen mode Exit fullscreen mode

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay