Rclone tutorial

From Pulsed Media Wiki

Rclone Commands (Debian/Ubuntu Linux)

This page lists common Rclone commands for managing cloud storage from the command line on Debian or Ubuntu.

1. Installation

Install Rclone using apt:

 sudo apt update
 sudo apt install rclone

2. Configuration: Set Up a Remote

Connect Rclone to your cloud storage. Run this command and follow the prompts:

 rclone config


Choose n to create a new remote.

Give it a name (e.g., mycloud).

Select your cloud provider from the list.

Follow the steps to authenticate (may involve a web browser).

Accept defaults for most options.

Type y to save, then q to quit.

3. Basic Commands

Replace mycloud: with the name you chose for your remote. Replace /path/to/local/ with your local folder path.

List Files and Folders

List files and directories:

 rclone ls mycloud:my/folder


List files with details (size, date):

 rclone lsl mycloud:my/folder


List only folders:

 rclone lsd mycloud:


Copy Files (copy)

Copy from source to destination. Existing files are skipped. Destination files are NOT deleted.

Local to Remote:

 rclone copy /path/to/local/data mycloud:backup/ --progress


Remote to Local:

 rclone copy mycloud:downloads/ /path/to/local/finished/ --progress


Sync Files (sync)

Make destination match source exactly. WARNING: This can delete files on the destination.

Local to Remote Sync:

 rclone sync /path/to/local/documents mycloud:live-sync/ --progress


Always test first (shows what would happen):

 rclone sync /path/to/local/documents mycloud:live-sync/ --dry-run


Move Files (move)

Move from source to destination. Files are deleted from source after transfer.

Local to Remote Move:

 rclone move /path/to/local/temp/ mycloud:archive/ --progress


Create Folder (mkdir)

Create a new folder on the remote:

 rclone mkdir mycloud:new_folder


Delete Files (delete)

Delete files in a path. Does NOT delete empty folders.

Delete a specific file:

 rclone delete mycloud:old_files/report.txt


Delete all files in a folder:

 rclone delete mycloud:temp_data/


Purge Folder (purge)

Delete a folder and ALL its contents. WARNING: Data will be lost.

Purge a folder:

 rclone purge mycloud:junk/


4. Advanced Commands & Options

Mount Cloud Storage (mount)

Access remote files like a local drive. Requires FUSE.

Install FUSE:

 sudo apt install fuse


Create a local folder for mounting:

 mkdir ~/cloud_drive


Mount the remote (runs in background &):

 rclone mount mycloud:remote_folder/ ~/cloud_drive --vfs-cache-mode writes --allow-other &


Unmount:

 fusermount -uz ~/cloud_drive


Filter Files

Use --include or --exclude with patterns.

Exclude temporary files:

 rclone copy source: dest: --exclude "*.tmp"


Include only image files:

 rclone sync source: dest: --include "*.jpg" --include "*.png"


Control Transfers

Show progress: --progress (add to any transfer command)

Parallel transfers (e.g., 8 files at once): --transfers 8

Parallel checks (e.g., 16 files at once): --checkers 16

Logging

Save command output to a file:

 rclone sync source: dest: --log-file /var/log/rclone.log