Did you know that you can post to paste bin from the Linux command line? This is a really useful method for storing textual information quickly online when you’re at the terminal.
What is pastebin?
A pastebin is another name for an online content hosting service. They are free and allow the user to store just plain text. This is useful for putting up source code snippets for code review, for SQL commands when collaborating with others remotely or for posting images. There are many pastebin services on the internet, some of which are hosted and some which are open source and available for self hosting.
So, how do you post to pastebin from the Linux command line?
To post to a pastebin from the command line, you need to use curl. (curl can be installed with your usual package manager or compiled from source.) You can post to the following sites using this method:
An example command to send the output of a dmesg to ptpb is:
dmesg | curl -F c=@- https://ptpb.pw
You can replace dmesg with any Linux command.
You can also upload a file (including images) to ptbb.pw too using the following command:
curl -F c=@- https://ptpb.pw < file
Published on Tue 13 November 2018 by Dave Wilson in Linux with tag(s): pastebin command line cli