# rclone — Sync and Manage Cloud Storage

> Practical guide to rclone — manage, sync and back up files across 70+ cloud backends like S3, Google Drive, Dropbox and SFTP from one command line.

Source: https://www.jpkc.com/db/en/cheatsheets/backup-sync/rclone/

<!-- PROSE:intro -->
rclone is the Swiss Army knife for cloud storage: a single command-line tool that manages files across more than 70 backends – from S3 and Google Drive to Dropbox, SFTP and Backblaze B2. You copy, sync, encrypt and mount remote storage with the same familiar commands, no matter which provider sits behind them. This guide walks you through the commands you reach for daily: configuration, backup and keeping data in sync.
<!-- PROSE:intro:end -->

## Configuration

`rclone config` — Interactive wizard to add, edit, or remove remotes.

```bash
rclone config
```

`rclone config show` — Print all configured remotes and their settings.

```bash
rclone config show
```

`rclone config show <remote>` — Print the configuration of a single remote.

```bash
rclone config show gdrive
```

`rclone config file` — Show the path to the rclone config file.

```bash
rclone config file
```

`rclone listremotes` — List all configured remote names.

```bash
rclone listremotes
```

`rclone config delete <remote>` — Delete a configured remote.

```bash
rclone config delete old-remote
```

## Listing Files & Directories

`rclone ls <remote>:<path>` — List all files in a remote path with sizes.

```bash
rclone ls gdrive:backups
```

`rclone lsd <remote>:<path>` — List directories only.

```bash
rclone lsd gdrive:
```

`rclone lsl <remote>:<path>` — List files with sizes and modification dates.

```bash
rclone lsl s3:mybucket/uploads
```

`rclone lsf <remote>:<path>` — List files and directories in a format easy to parse (one per line).

```bash
rclone lsf gdrive:photos
```

`rclone lsjson <remote>:<path>` — List files as a JSON array with metadata.

```bash
rclone lsjson gdrive:photos | jq '.[].Name'
```

`rclone ncdu <remote>:<path>` — Interactive disk usage browser (like ncdu) for remote storage.

```bash
rclone ncdu gdrive:
```

## Copying & Syncing

`rclone copy <source> <destination>` — Copy files from source to destination. Does not delete destination files.

```bash
rclone copy /home/user/photos gdrive:photos
```

`rclone copy <remote>:<path> <localpath>` — Download files from a remote to a local directory.

```bash
rclone copy gdrive:backups /tmp/restore
```

`rclone sync <source> <destination>` — Makes the destination identical to the source by deleting extra files in the destination. Destructive – unlike `rclone copy`; always test a run with `--dry-run` first.

```bash
rclone sync /home/user/docs gdrive:docs
```

`rclone sync <source> <destination> --backup-dir <dir>` — Move deleted/replaced files to a backup directory instead of deleting them.

```bash
rclone sync /home/user gdrive:home --backup-dir gdrive:home-backups/$(date +%F)
```

`rclone bisync <source> <destination>` — Bidirectional sync: propagates changes in both directions.

```bash
rclone bisync /home/user/docs gdrive:docs
```

`rclone move <source> <destination>` — Move files from source to destination. Deletes source files after transfer.

```bash
rclone move /tmp/uploads s3:mybucket/uploads
```

## Single File Operations

`rclone copyto <source-file> <dest-file>` — Copy a single file with an explicit destination filename.

```bash
rclone copyto backup.tar.gz s3:mybucket/archive/backup-2024-01-15.tar.gz
```

`rclone moveto <source-file> <dest-file>` — Move a single file with an explicit destination filename.

```bash
rclone moveto /tmp/export.csv gdrive:exports/report.csv
```

`rclone cat <remote>:<file>` — Print the content of a remote file to stdout.

```bash
rclone cat gdrive:config/settings.json
```

`rclone rcat <remote>:<file>` — Pipe stdin to a remote file (upload stream).

```bash
tar czf - /home/user | rclone rcat gdrive:backups/home.tar.gz
```

## Deleting & Cleaning

`rclone delete <remote>:<path>` — Delete all files in a remote path; directories are left in place. Destructive – check with `--dry-run` first.

```bash
rclone delete gdrive:temp
```

`rclone purge <remote>:<path>` — Delete a directory and all its contents. Destructive and cannot be undone.

```bash
rclone purge gdrive:old-backups/2020
```

`rclone deletefile <remote>:<file>` — Delete a single remote file.

```bash
rclone deletefile s3:mybucket/old-export.csv
```

`rclone cleanup <remote>:` — Clean up old versions and trash. Behavior depends on the backend.

```bash
rclone cleanup gdrive:
```

`rclone rmdir <remote>:<path>` — Remove an empty directory.

```bash
rclone rmdir gdrive:empty-folder
```

`rclone rmdirs <remote>:<path>` — Remove all empty directories under the given path.

```bash
rclone rmdirs gdrive:archive
```

## Filters & Exclusions

`rclone copy <source> <dest> --exclude <pattern>` — Exclude files matching a pattern from the operation.

```bash
rclone copy /home/user gdrive:home --exclude 'node_modules/**'
```

`rclone copy <source> <dest> --include <pattern>` — Include only files matching a pattern.

```bash
rclone copy /home/user/docs gdrive:docs --include '*.pdf'
```

`rclone copy <source> <dest> --filter-from <file>` — Read include/exclude rules from a file. Lines starting with + include, - exclude.

```bash
rclone copy /home/user gdrive:home --filter-from ~/.rclonefilter
```

`rclone copy <source> <dest> --min-size <size>` — Only transfer files larger than the specified size.

```bash
rclone copy gdrive:downloads /tmp --min-size 10M
```

`rclone copy <source> <dest> --max-age <age>` — Only transfer files modified more recently than the given age.

```bash
rclone copy /var/log s3:logs --max-age 24h
```

`rclone copy <source> <dest> --exclude-if-present <filename>` — Skip directories that contain the specified file (e.g. .rcloneignore).

```bash
rclone copy /home/user gdrive:home --exclude-if-present .nobackup
```

## Performance & Transfer Options

`rclone copy <source> <dest> --transfers <n>` — Number of file transfers to run in parallel (default: 4).

```bash
rclone copy /data s3:mybucket --transfers 16
```

`rclone copy <source> <dest> --checkers <n>` — Number of checkers to run in parallel (default: 8). Checkers verify file state before transfer.

```bash
rclone copy /data s3:mybucket --checkers 32
```

`rclone copy <source> <dest> --bwlimit <rate>` — Limit bandwidth. Supports rates like 1M, 512k, or a timetable.

```bash
rclone copy /home/user gdrive:home --bwlimit 5M
```

`rclone copy <source> <dest> --checksum` — Use checksums instead of modification time to determine if files differ.

```bash
rclone copy /important-data s3:mybucket --checksum
```

`rclone copy <source> <dest> --dry-run` — Preview what would be transferred without actually doing anything.

```bash
rclone sync /home/user gdrive:home --dry-run
```

`rclone copy <source> <dest> -P` — Show real-time transfer progress.

```bash
rclone copy /home/user gdrive:home -P
```

## Mount

`rclone mount <remote>:<path> <mountpoint>` — Mount a remote as a local filesystem (requires FUSE/WinFsp).

```bash
rclone mount gdrive: ~/gdrive
```

`rclone mount <remote>:<path> <mountpoint> --read-only` — Mount in read-only mode.

```bash
rclone mount s3:mybucket /mnt/s3 --read-only
```

`rclone mount <remote>:<path> <mountpoint> --daemon` — Mount in the background as a daemon.

```bash
rclone mount gdrive: ~/gdrive --daemon
```

`rclone mount <remote>:<path> <mountpoint> --vfs-cache-mode full` — Enable full VFS cache for better performance with random-access applications.

```bash
rclone mount gdrive: ~/gdrive --vfs-cache-mode full
```

## Serving

`rclone serve http <remote>:<path> --addr :<port>` — Serve a remote over HTTP.

```bash
rclone serve http gdrive:public --addr :8080
```

`rclone serve webdav <remote>:<path> --addr :<port>` — Serve a remote over WebDAV.

```bash
rclone serve webdav s3:mybucket --addr :8088
```

`rclone serve sftp <remote>:<path> --addr :<port>` — Serve a remote over SFTP.

```bash
rclone serve sftp gdrive: --addr :2022
```

## Hashing & Verification

`rclone check <source> <destination>` — Check source and destination files match (uses checksums if available, else size+modtime).

```bash
rclone check /home/user/photos gdrive:photos
```

`rclone md5sum <remote>:<path>` — Calculate MD5 checksums of all files in a remote path.

```bash
rclone md5sum gdrive:docs
```

`rclone sha1sum <remote>:<path>` — Calculate SHA-1 checksums of all files in a remote path.

```bash
rclone sha1sum s3:mybucket/uploads
```

`rclone hashsum <algorithm> <remote>:<path>` — Calculate checksums using the specified algorithm (MD5, SHA-1, SHA-256, etc.).

```bash
rclone hashsum SHA-256 gdrive:important
```

## Common Recipes

`rclone sync /home/user gdrive:home --exclude '.cache/**' --exclude 'node_modules/**' -P` — Sync home directory to Google Drive, excluding cache and node_modules, with progress.

```bash
rclone sync /home/user gdrive:home --exclude '.cache/**' --exclude 'node_modules/**' -P
```

`rclone copy <source> <dest1>: && rclone copy <source> <dest2>:` — Backup to two different cloud providers for redundancy.

```bash
rclone copy /data gdrive:backup && rclone copy /data b2:mybucket/backup
```

`tar czf - <path> | rclone rcat <remote>:<file.tar.gz>` — Create a tar archive on-the-fly and stream it directly to a remote.

```bash
tar czf - /var/www | rclone rcat s3:mybucket/www-$(date +%F).tar.gz
```

<!-- PROSE:outro -->
## Conclusion

rclone abstracts away each provider's quirks: once a remote is configured, you talk to every cloud backend with the same commands. Keep the difference between `copy` (only adds) and `sync` (makes the destination identical and deletes extra files) firmly in mind – and always preview destructive runs with `--dry-run` first. That makes rclone a dependable backbone for backups, migrations and data sync.

## Further Reading

- [rclone – official documentation](https://rclone.org/docs/) – complete reference for every command, flag and backend
- [rclone – GitHub project](https://github.com/rclone/rclone) – source code, releases and issue tracker
<!-- PROSE:outro:end -->

## Related Commands

- [borgbackup](https://www.jpkc.com/db/en/cheatsheets/backup-sync/borgbackup/) – deduplicating, encrypted backup program
- [duplicity](https://www.jpkc.com/db/en/cheatsheets/backup-sync/duplicity/) – encrypted, incremental backups to many storage targets
- [rdiff-backup](https://www.jpkc.com/db/en/cheatsheets/backup-sync/rdiff-backup/) – incremental backups with reversible history

