How to Share Terminal Logs Online in Linux Using the pastebinit Command

When collaborating on Linux servers, reporting technical bugs on developer forums, or asking for troubleshooting guidance on IRC channels and Discord, sharing verbose configuration files, systemd logs, and terminal diagnostics is an everyday necessity. However, copying thousands of lines of terminal output directly into chat dialogues or forum threads causes unreadable clutter and frequently truncates crucial debugging details.

Rather than manually redirecting terminal logs to local text files, transferring them to your desktop, and uploading them via a web browser, Linux administrators utilise pastebinit. Pastebinit is a lightweight command-line utility that captures standard input or files directly from your terminal, securely uploads the text to an open pastebin repository (such as Ubuntu’s official pastebin), and immediately returns a short, shareable URL. This tutorial walks you through installing pastebinit, piping command outputs, configuring custom pastebin destinations, and automating diagnostic sharing.

Installing pastebinit on Linux

The pastebinit package is maintained in the default software repositories of Debian, Ubuntu, and most modern Linux distributions. Check whether pastebinit is already installed by querying its help flag:

pastebinit -h

If it is not present on your system, install it using your distribution’s package manager:

On Ubuntu, Debian, and Linux Mint:

sudo apt update
sudo apt install pastebinit

On Fedora, RHEL, and CentOS Stream:

sudo dnf install pastebinit

On Arch Linux and Manjaro:

sudo pacman -S pastebinit

Listing Supported Pastebin Services

Pastebinit supports multiple public and private pastebin providers out of the box. To view the complete list of supported services available on your installation, execute:

pastebinit -l

This command outputs available pastebin identifiers, including paste.ubuntu.com, pastebin.com, fpaste.org, and other community-hosted services.

How to Upload a File Directly from Terminal

To upload an existing text file, such as a web server configuration or network setup script, pass the filename as an argument:

pastebinit /etc/netplan/01-netcfg.yaml

Pastebinit will connect to its default service (typically paste.ubuntu.com on Ubuntu systems), upload the contents, and print the resulting URL directly to your terminal:

https://paste.ubuntu.com/p/XyZ123abc/

You can share this link immediately with support staff or colleagues.

Piping Command Outputs and System Logs into pastebinit

The true power of pastebinit lies in its ability to read standard input through terminal pipes (|). This allows you to upload diagnostic outputs instantaneously without creating temporary files on disk:

1. Sharing Hardware Diagnostics

lshw -short | pastebinit

2. Sharing Kernel Ring Buffer Errors

dmesg -T --level=err,warn | pastebinit

3. Sharing systemd Journal Logs for a Specific Service

journalctl -u nginx.service -n 100 --no-pager | pastebinit

Customising the Pastebin Destination and Author Name

You can customise your submission by specifying an author handle, custom title, or alternate pastebin backend using command flags:

  • -b [service]: Specifies the target pastebin repository.
  • -a [author]: Attaches your username or email handle to the paste metadata.
  • -t

    Lorem ipsum dolor sit amet...

    : Adds a descriptive subject header to the uploaded snippet.

For example, to upload an Xorg crash log to Pastebin.com with custom author tags:

cat /var/log/Xorg.0.log | pastebinit -b pastebin.com -a "SysAdmin" -t "Xorg Crash Log"

Creating a Persistent Configuration File

If you prefer not to enter your preferred author handle or target backend every time, you can define global defaults inside a configuration file located at ~/.pastebinit.xml:

<pastebinit>
    <author>DevOpsTeam</author>
    <default>paste.ubuntu.com</default>
    <format>text</format>
</pastebinit>

With this configuration in place, running pastebinit will automatically apply your defined preferences for all future uploads.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.