Operations 8 min read

Master Fast, Secure File Sharing with transfer.sh: Command-Line Guide

This article explains why traditional cloud storage can be slow or limited, introduces the free command‑line tool transfer.sh, lists its key features, and provides step‑by‑step examples for uploading, downloading, encrypting, and automating file transfers across platforms.

Open Source Linux
Open Source Linux
Open Source Linux
Master Fast, Secure File Sharing with transfer.sh: Command-Line Guide

Transferring files between devices often requires third‑party software, faces size limits, or suffers from slow speeds, forcing users to pay for faster service.

Software Introduction

Easy and fast file sharing from the command-line.

Common services such as Baidu Cloud (speed‑limited for free users), Dropbox (very slow), Google Drive (requires VPN), Alibaba Cloud Drive (no speed limit but no upload acceleration), and Cow Transfer (size limits) have drawbacks. The article introduces a command‑line file transfer tool transfer.sh that addresses these issues.

Made for use with shell

Share files with a URL

For free

Upload up to 10 GB

Files stored for 14 days

Encrypt your files

Maximize amount of downloads

Usage

Sample use cases

[1] Command‑line usage

# Add the shell function to .bashrc or .zshrc
transfer() {
  if [ $# -eq 0 ]; then
    echo "No arguments specified."
    echo "Usage: "
    echo "  transfer <file|directory> ... | transfer <file_name>"
    return 1
  fi

  if tty -s; then
    file="$1"
    file_name=$(basename "$file")

    if [ ! -e "$file" ]; then
      echo "$file: No such file or directory"
      return 1
    fi

    if [ -d "$file" ]; then
      file_name="$file_name.zip"
      (cd "$file" && zip -r -q - .) | curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
    else
      cat "$file" | curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
    fi
  else
    file_name="$1"
    curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
  fi
}
# Now you can upload files
$ transfer hello.txt

[2] Simple file upload – official web interface

# Upload with curl
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
https://transfer.sh/66nb8/hello.txt

# Set max downloads and expiration
$ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt https://transfer.sh/hello.txt
https://transfer.sh/66nb8/hello.txt

# Download file
$ curl https://transfer.sh/66nb8/hello.txt -o hello.txt
# Upload with wget
$ wget --method PUT --body-file=/tmp/file.tar https://transfer.sh/file.tar -O - -nv

# Upload with HTTPie
$ http https://transfer.sh/ -vv < /tmp/test.log

# Upload with PowerShell
PS > invoke-webrequest -method put -infile .\file.txt https://transfer.sh/file.txt

[3] Upload multiple files at once

# Use filedata to send several files
$ curl -i -F filedata=@/tmp/hello.txt -F filedata=@/tmp/hello2.txt https://transfer.sh/

# Combine downloads into zip or tar archive
$ curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello2.txt).tar.gz
$ curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello2.txt).zip

[4] Encrypt files before transfer

# GPG encryption
$ cat /tmp/hello.txt | gpg -ac -o- | curl -X PUT --upload-file "-" https://transfer.sh/test.txt
# Download and decrypt
$ curl https://transfer.sh/1lDau/test.txt | gpg -o- > /tmp/hello.txt

# OpenSSL encryption
$ cat /tmp/hello.txt | openssl aes-256-cbc -pbkdf2 -e | curl -X PUT --upload-file "-" https://transfer.sh/test.txt
# Download and decrypt
$ curl https://transfer.sh/1lDau/test.txt | openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt

[5] Scan malware

# Scan with ClamAV
$ wget http://www.eicar.org/download/eicar.com
$ curl -X PUT --upload-file ./eicar.com https://transfer.sh/eicar.com/scan

# Upload to VirusTotal for permanent link
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal

[6] Backup and encrypt MySQL databases

# Backup + gzip + GPG + upload
$ mysqldump --all-databases | gzip | gpg -ac -o- | curl -X PUT --upload-file "-" https://transfer.sh/db_backup.txt

[7] Email transfer link

# Send link via email
$ transfer /tmp/hello.txt | mail -s "Hello World" [email protected]

[8] Transfer log files

# Pipe syslog through curl
$ cat /var/log/syslog | grep pound | curl --upload-file - https://transfer.sh/pound.log

Reference Links

transfer.sh official website

transfer.sh GitHub repository

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Shell scriptingfile sharingtransfer.sh
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.