Share terminal output with curl

snippet.sh is a pastebin for the terminal. Pipe the output of a command to curl, and you get a link. Send the link to another person, or open it on a different computer. The link expires after 5 minutes to 1 hour. No installation and no account are necessary.

Send the output of a command

echo "hello world" | curl -T- https://snippet.sh

The reply is one line: the link to the paste.

https://snippet.sh/p/7k2m9xq4tbn0

Examples:

make test 2>&1 | curl -T- https://snippet.sh
git diff | curl -T- https://snippet.sh
docker logs my-container 2>&1 | tail -n 200 | curl -T- https://snippet.sh
kubectl describe pod my-pod | curl -T- https://snippet.sh

Send a file

curl -T error.log https://snippet.sh

On Windows, use curl.exe. It is a part of Windows 10 and later versions.

curl.exe -T error.log https://snippet.sh

Options

Put the options in the query string. Put the URL in quotation marks.

  • ttl=5m, 10m, 30m, or 1h: the time until the paste expires. The default is 5 minutes.
  • burn=1: delete the paste after the first read.
make test 2>&1 | curl -T- 'https://snippet.sh?ttl=1h'
curl -T notes.txt 'https://snippet.sh?ttl=30m&burn=1'

Read a paste

A browser shows the paste on a page. A terminal gets the plain text. This lets you move text between two computers:

curl https://snippet.sh/p/7k2m9xq4tbn0 > notes.txt

You can use curl, Wget, HTTPie, or PowerShell. The ID is not case-sensitive, and it does not contain i, l, o, or u, so it is easy to type the link.

Show the instructions in your terminal

curl https://snippet.sh

Install the client

If you use snippet.sh frequently, install the shell client. It is one POSIX shell script, and it uses only curl.

mkdir -p "$HOME/.local/bin" && curl -fsSL https://snippet.sh/snippet -o "$HOME/.local/bin/snippet" && chmod +x "$HOME/.local/bin/snippet"

Make sure that ~/.local/bin is in your PATH. Then use the client:

make test 2>&1 | snippet --ttl 1h
cat notes.txt | snippet --burn

Limits and security

  • A paste contains UTF-8 text only, and its maximum size is 1 MiB.
  • One IP address can create 10 pastes each minute.
  • A terminal upload is not end-to-end encrypted. The connection to the server is encrypted, but the server stores the text as you sent it until the paste expires.
  • Anyone who has the link can read the paste. Do not send passwords or tokens from a terminal. For those, use the browser, which encrypts the text before the upload.