LinuxCommandLibrary

transfersh

Share files quickly via the command line

TLDR

Upload a file to transfer.sh

$ transfersh [path/to/file]
copy

Upload a file showing a progress bar (requires Python package requests_toolbelt)
$ transfersh --progress [path/to/file]
copy

Upload a file using a different file name
$ transfersh --name [filename] [path/to/file]
copy

Upload a file to a custom transfer.sh server
$ transfersh --servername [upload.server.name] [path/to/file]
copy

Upload all files from a directory recursively
$ transfersh --recursive [path/to/directory]/
copy

Upload a specific directory as an uncompressed tar
$ transfersh -rt [path/to/directory]
copy

SYNOPSIS

transfersh [options] file(s)...
transfersh [options] directory/
transfersh [options] - < input

PARAMETERS

file(s)
    The path(s) to the file(s) you want to upload. Multiple files can be uploaded, often compressed into a zip archive by the server.

directory/
    Uploads the contents of a directory. The server will typically zip the directory before serving.

-
    Reads input from standard input (stdin) for text uploads.

-s, --short-url
    Optional. Requests a shorter URL from the server, often using a custom domain.

-p, --progress
    Optional. Displays a progress bar during the upload process.

-g, --gist
    Optional. Primarily for text files. Uploads the content as a gist (pastebin-like format) if the server supports it.

-e
    Optional. Sets an expiration time for the uploaded file. Examples: 1h (1 hour), 1d (1 day), 1w (1 week).

-d , --downloads
    Optional. Sets the maximum number of times the file can be downloaded before it's removed.

-t, --no-progress
    Optional. Suppresses the upload progress bar.

--upload-only
    Optional. Uploads the file and prints the URL, but does not attempt to open it in a web browser.

--no-browser
    Optional. Similar to --upload-only, prevents opening the URL in a browser.

--zip
    Optional. Forces zipping of single files or multiple files/directories even if not strictly necessary.

DESCRIPTION

transfersh is a convenient command-line utility for uploading files to the transfer.sh file-sharing service. It provides a simple and quick way to share files directly from your terminal, receiving a URL in return that can be easily shared with others. The transfer.sh service supports various file types, and transfersh streamlines the upload process, often wrapping curl commands to interact with the service's API. It's particularly useful for quickly sharing logs, scripts, or small binaries during troubleshooting sessions or collaborative work, without the need for complex setup or authentication. Files are typically encrypted during transfer and can be configured with download limits or expiration times.

CAVEATS

transfersh is not a standard, pre-installed Linux command; it typically requires manual installation of a shell script or a separate client. It relies on the external transfer.sh service, which means:
Service Dependency: The availability and reliability of file sharing depend entirely on the transfer.sh service.
Privacy: Uploaded files are publicly accessible via the generated URL. While transfers are encrypted (HTTPS), the files are stored unencrypted on the server and are accessible to anyone with the link. Do not share sensitive or private information.
Retention Policy: Files are subject to the service's default retention policy (often 14 days) or specified expiration. They are not permanently stored.
File Size Limits: The service may impose limits on individual file sizes or total storage, though these are generally generous for casual use.

INSTALLATION

transfersh is typically installed by downloading a shell script and making it executable. A common method is:
curl -L https://transfer.sh/transfersh > ~/.local/bin/transfersh && chmod +x ~/.local/bin/transfersh
Ensure ~/.local/bin is in your system's PATH environment variable for easy access.

USAGE EXAMPLES

1. Upload a single file:
transfersh myfile.txt

2. Upload a file with a 7-day expiration:
transfersh -e 7d mydocument.pdf

3. Upload multiple files, forcing zipping:
transfersh --zip file1.log file2.conf

4. Upload content from stdin:
echo "Hello, world!" | transfersh -

SELF-HOSTING TRANSFER.SH

The transfer.sh service is open-source, allowing users to host their own private instances. This can be beneficial for organizations with strict privacy requirements or a need for custom configurations, reducing reliance on the public service.

HISTORY

The transfer.sh file-sharing service was created by Remco Verhoef as a simple, free, and open-source solution for quick file sharing. It gained popularity due to its command-line friendly nature, allowing users to upload files directly from their terminal using tools like curl. The transfersh command-line client itself is often a community-developed shell script wrapper that simplifies the curl commands, making it even more user-friendly. Its design philosophy emphasizes simplicity and efficiency for temporary file sharing, quickly becoming a go-to tool for developers and system administrators.

SEE ALSO

curl(1), wget(1), scp(1), rsync(1), nc(1), tar(1)

Copied to clipboard