Get the highlights in your inbox every week.
Share text instantly with this open source command | Opensource.com
Share text instantly with this open source command
Use pastebinit to share snippets of code, data, or text right from the command line.
Pastebin.com and similar websites make it quick and easy to share snippets of code, data, or text. Pastebin sites are often used when filing bug reports because projects often request that lengthy files or log outputs are put into a separate site. Sharing (non-sensitive) data over a pastebin site is helpful for doing this type of troubleshooting or collaboration while keeping bug reports easy to read.
But did you know you can publish a file from your computer or a Raspberry Pi to a pastebin site with a single command, pastebinit? It's open source licensed under GPLv2.0, and you can access its source code on GitHub.
Here's how to use it.
On a Raspberry Pi:
$ sudo apt install pastebinit
On Fedora or similar:
$ sudo dnf install pastebinit
MacOS users can install it using the Homebrew package manager with brew install pastebinit.
Share files with pastebinit
Usage is flexible and straightforward. Run pastebinit with the file you want to share, and it returns the URL where the file is shared:
There are two other ways to input a file. One is by piping to pastebinit:
$ less <filename> | pastebinit
Or you can redirect a file to the command:
All three options give the same results: the file is now visible online. Be sure you only share sanitized information because it will be publicly available.
$ pastebinit < <filename>
Since sharing logs from a system is common when troubleshooting and reporting bugs, it's helpful to use pastebinit as a quick way to get those files to a publicly available location. Be sure to only share files without usernames, passwords, or other personally identifying information you do not want to give to… everyone. If you feel confident that you know what you're sharing and why, pastebinit can save you a lot of time.