# rclone: A Command-Line Tool for Backing Up Your Files to the Cloud

Almost everything we value now exists only as digital files, from research data and thesis drafts to personal photos, and an accidental deletion or a ransomware attack can erase it in seconds, which is why a second copy kept somewhere else and updated automatically is no longer optional. **[rclone](https://rclone.org/)** is an exceptional command-line tool for exactly that. It is a free, open-source program that copies your files to almost any online storage (Google Drive, OneDrive, Dropbox, Amazon S3, Backblaze B2 or your own server) with one short command. It only transfers what has changed, it can encrypt everything before it leaves your device, and it can run by itself every night. In this article I show how to install it, connect a storage account and build a simple, safe backup routine around it.

## Why rclone?

People often call it "rsync for the cloud", and that is a good first picture. What makes it so useful as a backup solution:

- **One tool for many clouds.** It supports more than 70 storage providers, plus plain protocols such as SFTP, WebDAV and FTP. Switching provider later means changing a name, not learning a new tool.
- **Smart transfers.** It compares size, modification time or checksums and copies only new and changed files, so the second run is much faster than the first. Interrupted transfers simply continue.
- **Client-side encryption.** The *crypt* feature encrypts file contents and file names before upload, so the provider only ever sees scrambled data.
- **Verification.** `rclone check` compares both sides, so you know the backup is really complete.
- **Scriptable.** It is a single executable with clear exit codes, logs and filters, which makes it ideal for cron jobs and scheduled tasks.
- **Cross-platform and free.** Linux, Windows, macOS and BSD, released under the MIT licence.

## Installation

On Linux and macOS the official install script fetches the latest release:

```bash
sudo -v ; curl https://rclone.org/install.sh | sudo bash
```

Package managers work too, although the version in the Debian and Ubuntu repositories is often older than the current release:

```bash
sudo apt install rclone      # Debian / Ubuntu
brew install rclone          # macOS (Homebrew)
winget install Rclone.Rclone # Windows
```

Check that it works:

```bash
rclone version
```

## Connect a storage account

rclone calls every storage location a **remote**. Create one with the interactive wizard:

```bash
rclone config
```

Choose `n` (new remote), give it a short name such as `gdrive`, pick the provider from the list and follow the questions. For Google Drive, OneDrive and Dropbox the wizard opens a browser window so you can sign in and authorise access; on a server without a browser it prints a command to run on another machine. The result is saved in a config file whose location you can print with:

```bash
rclone config file
```

That file contains access tokens, so treat it like a password. From the same `rclone config` menu you can set a configuration password (`s`) to encrypt it.

A first look around:

```bash
rclone listremotes          # your configured remotes
rclone lsd gdrive:          # top-level folders of the remote
rclone ls gdrive:Documents  # files inside a folder
rclone about gdrive:        # used and free space
```

## Copy, sync and check

Three commands do most of the work, and the difference between the first two matters.

**`copy`** puts new and changed files at the destination and never deletes anything there:

```bash
rclone copy ~/Documents gdrive:backup/Documents --progress
```

**`sync`** makes the destination identical to the source, so files you removed locally are *deleted* at the destination as well:

```bash
rclone sync ~/Documents gdrive:backup/Documents --progress
```

<div class="alert alert-warning"><strong>Always rehearse a sync first.</strong> Add <code>--dry-run</code> (or <code>-n</code>) and rclone prints what it <em>would</em> do without touching a single file. Also remember that the source and destination are not interchangeable: swapping them turns a harmless backup into a deletion of your originals.</div>

```bash
rclone sync ~/Documents gdrive:backup/Documents --dry-run
```

**`check`** compares both sides and reports any differences, which is how you verify a backup:

```bash
rclone check ~/Documents gdrive:backup/Documents
```

To restore, copy in the other direction into an empty folder:

```bash
rclone copy gdrive:backup/Documents ~/Restore --progress
```

## Choose what to back up

You rarely want everything. Filters keep temporary and generated files out of the cloud:

```bash
rclone sync ~/Research gdrive:backup/Research \
  --exclude ".git/**" \
  --exclude "*.tmp" \
  --exclude "__pycache__/**" \
  --max-size 2G
```

For longer lists put one rule per line in a file and use `--exclude-from rules.txt`. Two options help on slow connections or shared machines: `--bwlimit 2M` caps the transfer speed and `--transfers 8` sets how many files move in parallel.

## Sync is not a backup, so keep history

A plain `sync` mirrors your mistakes: if you delete or overwrite a file and sync again, the cloud copy changes too. The easy remedy is `--backup-dir`, which moves anything that would be replaced or deleted into a dated archive folder instead of destroying it:

```bash
rclone sync ~/Research gdrive:backup/current \
  --backup-dir gdrive:backup/archive/$(date +%F)
```

Now `backup/current` always mirrors your computer, while `backup/archive/2026-11-01` holds yesterday's versions of everything that changed. Delete old archive folders when you no longer need them. Some providers, such as Backblaze B2 and Amazon S3, can also keep file versions on their side if you turn on bucket versioning.

## Encrypt before you upload

For a thesis draft, data or anything personal, add a **crypt** remote that wraps another remote. Run `rclone config`, create a new remote, choose the type `crypt` and point it at a folder of an existing remote, for example `gdrive:encrypted`. Let rclone generate the passwords, then store them somewhere safe (a password manager), because **without them the data cannot be recovered**. After that you simply use the new name:

```bash
rclone sync ~/Research secret: --progress
```

The provider sees only unreadable file names and contents, while `rclone ls secret:` shows you the real ones.

## Run it automatically

A backup that depends on remembering to run it will eventually be forgotten. Put the command in a small script, for example `~/bin/backup.sh`:

```bash
#!/bin/sh
rclone sync "$HOME/Research" gdrive:backup/current \
  --backup-dir "gdrive:backup/archive/$(date +%F)" \
  --exclude ".git/**" \
  --log-file "$HOME/rclone-backup.log" --log-level INFO
```

Make it executable with `chmod +x ~/bin/backup.sh`, open the cron table with `crontab -e` and run it every night at 02:00:

```bash
0 2 * * * /home/YOUR_USER/bin/backup.sh
```

On Windows, create a task in Task Scheduler that starts `rclone.exe` with the same arguments. Look at the log file now and then, and run `rclone check` occasionally to confirm that the backup is complete.

## More things it can do

- **`rclone mount`** shows a remote as a normal folder on your computer (on Windows this needs [WinFsp](https://winfsp.dev/)). Use `--vfs-cache-mode writes` for smooth editing of files.
- **`rclone ncdu remote:`** is an interactive disk-usage browser for cloud storage, handy for finding what eats your quota.
- **`rclone serve`** exposes a remote over HTTP, WebDAV, SFTP and more.
- **`rclone bisync`** keeps two locations in sync in both directions. Read its documentation before relying on it for important data.

## Good to know

- Google Drive limits how many requests one application may make, so heavy users get better speed by creating their own *client ID* in the Google Cloud console, as the rclone documentation for the Drive backend explains.
- Not every provider supports checksums or modification times; rclone chooses the best available comparison and tells you in the documentation of each backend.
- Test a restore once. A backup you have never restored is only a hope.

For the full command list and the pages for each storage provider, see the [rclone documentation](https://rclone.org/docs/).
