Skip to content

How to use Pastebin from your Linux terminal to exchange text online

Pastebins have been on the Internet since the 1990s and are simple text-based repositories where you can dump large amounts of text, code, or any other type of documentation. They are very useful if you don’t want to clutter other communication channels with walls of text.

Traditionally, you need to create an account with a website-based service to use pastebin, however with you can create pastebins without even leaving your terminal.

What is Pastebin and Why Use It?

01 - How to use Pastebin from your Linux terminal to exchange text online

The Internet is an unimaginably large storehouse of information; for the most part, it is desirable that there be some structure and permanence. For example, you should always be able to find websites and interesting articles in the same place, and you want the stream of consciousness you spill on your blog or social media to remain visible and searchable until you decide remove it.

Other information is temporary. You want to be able to show it for a limited period of time and then expire so it’s never seen again.

Pastebin provides this utility – it takes your raw text and returns a link where you can view the text.

The reasons why you might want this are varied. You may want to post a large block of text in an IRC chat, but are afraid of ruining the flow of the conversation. Perhaps you want a colleague to review your code before committing, and you don’t want to insert several thousand lines into an email.

Instead, you paste your code into a pastebin and send the link via email or SMS, or simply write the URL on the back of the envelope. It’s simple, it’s easy, and it’s incredibly useful.

But using pastebin has its drawbacks: you usually need to create an account, and worse, you need to exit the terminal and open a browser in order to use pastebin. is different. You don’t need to share your email address, social media login, or anything else. Instead, you create your account in your terminal using public key encryption via SSH, and you can also SCP (securely copy) your pastes to the server from your terminal.

Getting started with on Linux

02 - How to use Pastebin from your Linux terminal to exchange text online

Due to the limitations of the Golang SSH package, there is a good chance that the standard SSH keys generated by your distribution will not work with You will need to generate a new SSH key with the Ed25519 algorithm:

ssh-keygen -t ed25519 -C "[email protected]"

Press Enter when prompted to “Enter the file where you want to save the key” and then choose a secure password (or don’t enter one. It’s up to you). The key will be saved to the default folder.

Now connect to the SSH server with:

ssh [email protected]

This is a special login that does not require a password and will always send you to create an account.

When prompted, choose a username that is less than 50 characters long and consists of simple letters and numbers. The system will reject any spammy username that includes strings such as “admin”, “abuse”, “root”, “cgi”, etc. You cannot use underscores.

03 - How to use Pastebin from your Linux terminal to exchange text online

If your username is accepted, you’ll see a screen with the URL for your embeds and some control options. You can change your username, manage your encryption keys, and view embeds associated with your account.

Use to create pastes from your terminal

04 - How to use Pastebin from your Linux terminal to exchange text online

Pastes are text files, so it is recommended to have a special directory for pastes in your home directory. Create it:

mkdir ~/pastes

Any time you create a text file that you want to send to, you must create it here. For example:

nano pastes/thisfile

The filename extension doesn’t really matter.

When you’re done, save and exit nano by pressing Ctrl + O and then Ctrl + R.

You can send files to your pastebin with:

scp ~/pastes/*

…or you can send files individually with:

scp thisfile

05 - How to use Pastebin from your Linux terminal to exchange text online

Alternatively, if you just want to paste a quick note from the command line without having to worry about opening a dedicated text editor, you can pass the text directly. For example:

echo "MUO is the number one source of awesome tech news, and fabulous Linux tutorials" | ssh

… will create a new insert with this content. It will generate a random filename and return it to you as output.

If you want to specify a filename, add your preferred filename to the previous command.

echo "Open source 4 eva" | ssh foss

The above command will create a file named foss containing the text “Open source 4 eva” available via “”.

You can use Pastebins for anything!

Pastebin is incredibly useful if you want to get text out into the world and don’t care too much about how it looks. Whether you’re pasting code snippets, business drafts, or a full-length novel, the message matters.

And if your inserts should help with a project, consider adding other great tools and techniques to help improve collaboration.

2585810cookie-checkHow to use Pastebin from your Linux terminal to exchange text on the Internetno


#Pastebin #Linux #terminal #exchange #text #online

❤ XOXO ❤

Leave a Reply

Your email address will not be published. Required fields are marked *