How to Use Pastebins From Your Linux Terminal to Share Text Online

Pastebins have been a feature of the internet since the 1990s, and are simple text repositories where you can dump large amounts of writing, code, or any other type of documentation. They’re super useful if you don’t want to clutter up other communication channels with walls of text.

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

What Is a Pastebin, and Why Would You Use One?

A board filled with sticky notes containing motivational words

The internet is an unimaginably large trove of information; for most of it, it’s desirable that there’s some structure and permanence. You should always be able to find websites and interesting articles in the same place, for instance, and you want the stream of consciousness that you spill onto your blog or social media to remain visible and findable until you decide to delete it.

Other information is transient by nature. You want to be able to show it for a limited period and then have it expire, never to be seen again.

Pastebins provide this utility—accepting your raw text, and returning a link at which you can view the text.

The reasons you may want this are varied. You might want to post a large block of text into an IRC chatroom, but are worried about messing up the flow of the conversation. It could be that you want a colleague to evaluate your code before you commit, and don’t want to paste a few thousand lines into an email.

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

But using a pastebin has its downsides: you usually need to create an account, and worse, you need to leave your terminal and open up a browser to use a pastebin. is different. You don’t need to hand over your email address, your social media handle, or anything else. Instead, you create your account from within your terminal using public key encryption over SSH, and you can SCP (secure copy) your pastes to the server from within your terminal, too.

Get Started With on Linux

generate ed25519 ssh key

Because of limitations with Golang’s SSH package, there’s a good chance that the standard SSH keys created by your distro won’t work with You will need to create a new SSH key with the Ed25519 algorithm:

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

Hit Enter when prompted to “Enter a file in which to save the key”, then choose a secure password (or don’t. It’s up to you). The key will be saved to the default location.

Now connect to the SSH server with:


This is a special sign-in that does not require a password, and will always send you to account creation.

At the prompt, pick a username, with under 50 characters, comprising plain letters and numbers. The system will reject any spammy username which includes strings such as “admin”, “abuse”, “root”, “cgi”, or similar. You can’t use underscores.

pastes management in terminal

If your username is accepted, you’ll see a screen with a URL for your pastes, and certain management options. You can change your username, manage your encryption keys, and view the pastes linked to your account.

Use to Create Pastes From Your Terminal

pastes archive in firefox

Pastes are text files, so it’s a good idea for you to have a dedicated directory for pastes within your home directory. Create one with:

 mkdir ~/pastes 

Any time you create a file containing the text you want to send to, you should create it here. For instance:

 nano pastes/thisfile 

As you’re using Linux, the filename extension doesn’t actually matter.

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

You can send files to your pastebin with:

 scp ~/pastes/* 

…or you can send files individually with:

 scp thisfile 
echo text to pastes via ssh

Alternatively, if you just want to paste a quick note from the command line, without the bother of opening a dedicated text editor, you can pipe the text directly.

For instance:

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

…will create a new paste with that content. It’ll generate a random filename and return it to you as output.

If you want to specify a file name, append your preferred filename to the previous command.

 echo "Open source 4 eva" | ssh foss 

The above command will generate a file named foss containing the text “Open source 4 eva”, accessible through “”.

You Can Use Pastebins for Anything!

Pastebins are incredibly useful if you want to get text out into the world, and you’re not overly concerned about how it appears. Whether you’re pasting code snippets, business drafts, or a full-length novel, it’s the message that matters.

And if your pastes are to help with a project, consider adding other great tools and methods to help boost collaboration.


🧪 |Medical Laboratory Scientist 🥇 | Mindset over Everything. 
 🤝 | Let's Grow Together.

Related Articles

Leave a Reply

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

Back to top button