Skip to main content

rclone Cat

rclone cat reads a remote file and prints its contents to standard output, just like the Unix cat command. It's the quickest way to inspect small config files, logs, or text files on a remote without downloading them first.

Quick Summary

cat streams the file directly to your terminal. It works for any file type, but is most useful for text files. For binary files or large files, download with copy instead.

Basic Syntax

rclone cat REMOTE:PATH [flags]
# Print a remote file
rclone cat remote:configs/app.conf

# Print a specific file from a bucket
rclone cat remote:my-bucket/README.md

# Pipe to other commands
rclone cat remote:logs/error.log | grep "CRITICAL"

Key Flags

FlagDescription
--head NPrint only the first N bytes
--tail NPrint only the last N bytes
--offset NStart reading from byte offset N
--count NRead N bytes total
--discardDiscard output (useful for bandwidth testing)

Practical Examples

Check a Remote Config File

rclone cat remote:configs/nginx.conf

Preview First Lines of a Log

# First 1 KB of a log file
rclone cat remote:logs/access.log --head 1024

Tail a Remote Log

# Last 2 KB of an error log
rclone cat remote:logs/error.log --tail 2048

Search in Remote Files

# Find errors in remote logs
rclone cat remote:logs/app.log | grep -i "error"

# Count warnings
rclone cat remote:logs/app.log | grep -c "WARNING"

Quick Database Dump Inspection

# Check header of a SQL dump
rclone cat remote:backups/db/latest.sql --head 500

Compare Remote File with Local

diff <(rclone cat remote:configs/app.conf) /etc/app/app.conf

Common Pitfalls

PitfallConsequencePrevention
Cat-ing a large binary fileTerminal flooded with garbageUse --head to preview, or copy to download
Cat-ing a multi-GB fileSlow download, fills terminal bufferCheck size with rclone size first
Using cat for file transferInefficient, no resumeUse copy or copyto for proper transfers

What's Next

Examples with Output

1. View a remote text file

Quickly read the contents of a README or small configuration. Command:

rclone cat gdrive:README.txt

Output:

Welcome to the Rclone project.
This is a sample text file stored on Google Drive.

2. Preview the start of a large log

Inspect the first few lines to check for startup errors. Command:

rclone cat remote:logs/app.log --head 500

Output:

[2024-01-15 08:00:00] INFO: Application starting...
[2024-01-15 08:00:01] INFO: Connecting to database...

3. Check the end of a process log

See the most recent entries without downloading the whole file. Command:

rclone cat remote:logs/process.log --tail 1024

Output:

[2024-01-15 12:00:00] SUCCESS: Job completed.
[2024-01-15 12:00:01] INFO: Summary: 500 records processed.

4. Search remote file for errors

Pipe the output to grep for fast cloud-based searching. Command:

rclone cat remote:app/error.log | grep "CRITICAL"

Output:

CRITICAL: Connection timed out after 30s
CRITICAL: Fatal disk error detected

5. Verify file content directly

Confirm the latest version of a file matches your expectations. Command:

rclone cat remote:config/version.txt

Output:

v1.2.3-stable