Tips & Tricks

Shell Completion

How to set up tab completion for rclone in your shell

Tab completion makes using rclone much faster and helps prevent typos.

Since completions aren’t set up automatically, make this one of the first things you configure after installing rclone.

What is shell completion?

Instead of typing full commands:

rclone copy /local/path remote:destination --progress

You can use Tab to complete:

rcl<Tab>           # → rclone
rclone co<Tab>     # → rclone copy
rclone copy --pro<Tab>  # → rclone copy --progress
rclone copy local:<Tab> # Shows available paths!

Shells

Zsh (oh my zsh, similar)

# Generate completion file
rclone completion zsh > ~/.config/rclone/rclone-completion.zsh

# Add to ~/.zshrc
echo 'source ~/.config/rclone/rclone-completion.zsh' >> ~/.zshrc

# Reload shell
source ~/.zshrc

# Test it!
rclone <Tab>

Power Features

# Enable menu selection
zstyle ':completion:*' menu select

# Case-insensitive completion
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

# Colorful completions
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}

# Group completions by type
zstyle ':completion:*' group-name ''
zstyle ':completion:*:descriptions' format '%B%F{yellow}%d%f%b'

Bash

# Generate completion file
rclone completion bash > ~/.config/rclone/rclone-completion.bash

# Add to ~/.bashrc or ~/.bash_profile
echo 'source ~/.config/rclone/rclone-completion.bash' >> ~/.bashrc

# Reload shell
source ~/.bashrc

# Test it!
rclone <Tab>

Enhanced Completions

# Enable extended completions
shopt -s extglob

# Case-insensitive
bind "set completion-ignore-case on"

# Show all if ambiguous
bind "set show-all-if-ambiguous on"

# Color completions
bind "set colored-stats on"

Fish

# Generate and install directly
rclone completion fish > ~/.config/fish/completions/rclone.fish

# That's it! Fish loads automatically
# Test it!
rclone <Tab>

Abbreviations

# Fish has great defaults!
# Just add abbreviations
abbr rc 'rclone copy'
abbr rs 'rclone sync'
abbr rm 'rclone mount'

# Interactive mode
rclone <Tab><Tab>  # Shows descriptions!

PowerShell (Windows)

# Generate completion file
rclone completion powershell > $HOME\rclone-completion.ps1

# Add to profile
Add-Content $PROFILE 'source $HOME\rclone-completion.ps1'

# Reload
. $PROFILE

# Test it!
rclone <Tab>

For all users (requires sudo):

# Bash (Ubuntu/Debian)
sudo rclone completion bash > /etc/bash_completion.d/rclone

# Zsh
sudo rclone completion zsh > /usr/share/zsh/site-functions/_rclone

# Fish
sudo rclone completion fish > /usr/share/fish/vendor_completions.d/rclone.fish

Tmux

# Complete in tmux panes
tmux send-keys -t 2 "rclone copy " Tab

Vim/Neovim

" ~/.vimrc or ~/.config/nvim/init.vim
" Run rclone commands with completion
nnoremap <leader>rc :!rclone 

What can be completed?

Commands

rclone c<Tab>
# cat check cleanup config copy copyto copyurl cryptcheck cryptdecode

Flags

rclone copy --<Tab>
# --backup-dir --bwlimit --checkers --checksum --config --contimeout ...

Remote Names

rclone ls <Tab>
# gdrive: dropbox: s3: local-backup: encrypted:

Remote Paths

rclone ls gdrive:<Tab>
# gdrive:Documents/ gdrive:Photos/ gdrive:Backup/

Troubleshooting

Completions not working

  1. Check installation:
# Find where completion was installed
ls ~/.config/rclone/rclone-completion.*
ls ~/.oh-my-zsh/custom/plugins/rclone/
  1. Verify sourcing:
# Check if it's being loaded
grep "rclone-completion" ~/.zshrc
grep "rclone-completion" ~/.bashrc
  1. Regenerate:
# Delete old and regenerate
rm ~/.config/rclone/rclone-completion.*
rclone completion zsh > ~/.config/rclone/rclone-completion.zsh
source ~/.zshrc

Slow completions

# Zsh: Rebuild completion cache
rm -f ~/.zcompdump*
compinit

# Limit remote path completion depth
# Add to ~/.zshrc
zstyle ':completion:*:rclone:*' max-depth 2

Missing remote paths

# Make sure config is readable
chmod 600 ~/.config/rclone/rclone.conf

# Test remote listing
rclone listremotes

How is this guide?