Home / Alt manpages / pastebinit(1)

  • pastebinit(1)
  • User command
  • linux

Send a Safe Text Paste from the Linux Shell with pastebinit

You will finish with a repeatable way to send text from a pipe or file to a pastebin and capture the returned URL. The examples match pastebinit 1.6.2, installed here as Debian package version 1.6.2-1.

Allow about ten minutes. You need a shell, the pastebinit package and network access to the pastebin you choose. No elevated privileges are needed. The command sends data to an external service, so never use it for passwords, private keys, access tokens, personal data or logs that contain them.

1. Check the installed command

Confirm the package and read the local option list before sending anything. These are ordinary read-only commands:

$ dpkg-query -W -f='${Package} ${Version}\n' pastebinit
pastebinit 1.6.2-1
$ pastebinit -v
pastebinit v1.6.2
$ pastebinit -h
pastebinit v1.6.2
...
Usage:  pastebinit [OPTION...] [FILE...]
...

The command reads standard input by default. It can also take file names as arguments. The installed help reports dpaste.com as this host's default target, although distributions and configuration files can change that default.

Checkpoint

Stop here if the package version or default target is different from the one you intended to use. Rerun pastebinit -h on the machine where the paste will be made.

2. Inspect the text before it leaves the machine

Prepare a small, deliberately harmless test file. This creates a temporary file under /tmp, not a paste:

$ printf '%s\n' 'pastebinit smoke test: replace this text' > /tmp/pastebinit-demo.txt
$ sed -n '1,5p' /tmp/pastebinit-demo.txt
pastebinit smoke test: replace this text

Read the complete input before substituting a real path. A shell pipeline can hide the source of a large or sensitive document, and a file can contain credentials in a line that was not meant to be shared. If the file is no longer needed, remove this temporary copy:

$ rm -- /tmp/pastebinit-demo.txt

That removal is local and irreversible through the file system. It does not remove a paste that has already been uploaded.

3. Send standard input

Once the content is safe to publish, pipe it to pastebinit. This example makes a network request and creates a paste on the selected service:

$ printf '%s\n' 'pastebinit smoke test: replace this text' | pastebinit
https://dpaste.com/EXAMPLE

The final line is the URL returned by the pastebin. The identifier and URL are variable. Keep the URL private if the paste contains anything that is not meant for public discovery. A paste URL is not a substitute for access control.

Do not paste a shell command containing secrets directly into the pipeline. Shell history, terminal recording and process supervision can retain more than the remote service does.

4. Send a file and preserve a local copy

Pass one or more file names as arguments when the input already exists:

$ pastebinit /tmp/pastebinit-demo.txt
https://dpaste.com/EXAMPLE

You can use -i FILE for the same single-input purpose. If you pass more than one file, pastebinit reads each one and submits each non-empty document. The output is therefore one URL per document. Verify the local input first, especially when a wildcard is involved:

$ printf 'files to send:\n'
$ printf '%s\n' /tmp/pastebinit-demo.txt
/tmp/pastebinit-demo.txt
$ pastebinit -i /tmp/pastebinit-demo.txt
https://dpaste.com/EXAMPLE

An empty input is rejected locally with You are trying to send an empty document, exiting. A missing or unreadable file is also an error. Neither condition should be treated as a successful upload.

5. Add useful metadata without assuming it is supported

Optional fields are passed with short options. Pastebinit documents these as pastebin-dependent, so a target may ignore some of them:

$ printf '%s\n' 'harmless diagnostic text' | pastebinit \
    -a 'Example operator' \
    -t 'Network smoke test' \
    -f text \
    -P 1
https://dpaste.com/EXAMPLE

-a sets the author, -t the title, -f the format and -P the private level understood by the selected pastebin. The local defaults are the current USER value for the author, no title, text format and private level 1. These are request values, not a guarantee that the service will make a paste private.

Do not put a password on the command line merely because -u and -p exist. Command-line arguments can be visible to other local users through process inspection. Use those options only after checking the selected pastebin's authentication behaviour and the security policy of the host.

6. Choose a target and inspect available targets

Use -b to select a configured pastebin by name:

$ printf '%s\n' 'harmless diagnostic text' | pastebinit -b dpaste.com
https://dpaste.com/EXAMPLE

List the targets known to this installation without submitting a paste:

$ pastebinit -l
Supported pastebins:
- dpaste.com
- paste.debian.net
...

The exact list is host-specific. User configuration can override the supplied definitions. The XML file ~/.pastebinit.xml can set a default pastebin, author, format, jabber ID and private value. Per-service files under ~/.pastebin.d can override service details; XDG configuration and data locations are supported too. Treat these files as configuration that changes where data goes, not as harmless display preferences.

7. Diagnose a failed submission

Use verbose mode when you need to see the selected endpoint and request parameters:

$ printf '%s\n' 'harmless diagnostic text' | pastebinit -V
POSTing to: https://dpaste.com/api/v2/
Params: ...
https://dpaste.com/EXAMPLE

Verbose output can include the text sent in the request parameters. Do not capture it in a shared log or paste it into a ticket without checking it first.

A failed network request prints an error such as Failed to contact the server and exits non-zero. Check the target with pastebinit -l, confirm DNS and connectivity, then retry only if you are sure the first request did not succeed. Repeating a request can create duplicate pastes.

If the target is unknown, pastebinit reports that the website is not configured. Use a name from pastebinit -l or review the relevant .conf file. Do not invent a service name and expect the tool to discover it.

Done means

  • You checked the installed pastebinit version and target list.
  • You inspected the exact text before sending it.
  • You used stdin or an explicit file and captured the returned URL.
  • You treated privacy options as service-dependent rather than as a promise.
  • You kept passwords, tokens, private keys and personal data out of the request.
  • You know that deleting a local file cannot recall an already-created paste.