Cloud Syncing with rclone

rclone syncs files with cloud storage (e.g., Google Drive, S3).

$ sudo apt install rclone
$ rclone config  # Setup cloud remote
$ rclone copy /local/path remote:path

Example:

$ rclone copy ~/docs gdrive:backup/

Peer-to-Peer Sync

syncthing synchronizes files securely between devices.

$ sudo apt install syncthing
$ syncthing  # Start daemon, access via http://localhost:8384

Example: Sync a folder via the web interface.

Practical Examples

Backup directory:

$ rsync -avz ~/docs/ amar@192.168.1.100:/backup/docs/

Download via FTP:

$ lftp -e "get file.txt; quit" ftp://user:pass@ftp.example.com

Cloud backup:

$ rclone copy ~/projects gdrive:projects/

Practice Time!

Test your skills:

  1. Copy a file to a remote server with scp.
  2. Sync a directory with rsync.
  3. Download a file using sftp.
  4. Explore an FTP server with ncftp.
  5. Back up to cloud storage with rclone.

Try This: Run scp file.txt user@remote:/home/user/ and share your success on X with #LinuxCommandLine!

Linux File Transfer Tools
Linux File Transfer Tools. AI generated image – StarryAi

RSYNC Command Flag Combinations

Flag Combination Description
rsync -avz Archives (-a) and compresses (-z) files while preserving permissions and timestamps (-v).
rsync -anv Performs a dry run (-n) and displays verbose output (-v) without actually transferring files.
rsync -rtv Preserves timestamps (-t) and recursively (-r) synchronizes files while displaying verbose output (-v).
rsync -azu Updates (-u) files only if the source file is newer, and compresses (-z) files while preserving permissions and timestamps (-a).
rsync -avz --delete Deletes files on the destination that do not exist on the source, while archiving (-a) and compressing (-z) files.
rsync -rtv --include Recursively (-r) synchronizes files while displaying verbose output (-v), and includes only files specified in the include file.
rsync -azu --exclude Updates (-u) files only if the source file is newer, and compresses (-z) files while preserving permissions and timestamps (-a), excluding files specified in the exclude file.
rsync -avz --progress Displays progress information while archiving (-a) and compressing (-z) files.
rsync -rtv --dry-run Performs a dry run (-n) and displays verbose output (-v) while recursively (-r) synchronizing files.
rsync -azu --stats Displays statistics about the transfer while updating (-u) files only if the source file is newer, and compressing (-z) files while preserving permissions and timestamps (-a).

RClone Command Flag Combinations

Flag Combination Description
rclone -v --dry-run Performs a dry run and displays verbose output.
rclone -P --transfers=2 Limits the number of concurrent transfers to 2 and displays progress information.
rclone -vv --stats=1s Displays very verbose output and updates statistics every 1 second.
rclone -q --ignore-size Ignores file sizes and performs a quiet transfer.
rclone -v --update Updates files only if the source file is newer, and displays verbose output.
rclone -P --filter-from=exclude.txt Excludes files specified in the exclude.txt file and displays progress information.
rclone -vv --bwlimit=10M Limits the bandwidth to 10MB/s and displays very verbose output.
rclone -q --checksum Verifies file integrity using checksums and performs a quiet transfer.
rclone -v --include-from=include.txt Includes only files specified in the include.txt file and displays verbose output.
rclone -P --retries=3 Retries failed transfers up to 3 times and displays progress information.

Glossary of Commands, Tools, and Shortcuts

Reference: For detailed documentation, visit Linux Manpages. For package installation, search on Debian APT.

Command/Tool Description
scp Securely copies files over SSH.
rsync Synchronizes files efficiently.
sftp Interactive secure file transfers.
lftp Advanced multi-protocol transfers.
ncftp User-friendly FTP client.
rclone Syncs files with cloud storage.
syncthing Peer-to-peer file synchronization.

Relevant Websites:


That’s it for Chapter 18 ! You’ve now learned how to use linux file transfer tools to move files between systems efficiently and securely. We’ve covered the basics of using Ncftp and Lftp, two popular command line FTP tools. These tools provide a user-friendly interface for interacting with FTP servers, allowing users to upload, download, and manage files on the server. By mastering these tools, you’ll be well on your way to becoming a proficient Linux user.In the next chapter, we’ll dive into Linux security basics—how to secure your system using SSH, firewalls, and encryption. Until then, practice transferring files to become more comfortable with these tools.

Previous: Part III | Next: Chapter 19

Pages: 1 2