How to Use Pastebins From Your Linux Terminal to Share Text Online
Reading Time: 4 minutesPastebins help you effortlessly share walls of text with someone on the internet. Here’s how to use pastebins from your Linux terminal with pastes.sh.
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 pastes.sh, you can create pastes without ever leaving your terminal.
What Is a Pastebin, and Why Would You Use One?
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.
pastes.sh 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 pastes.sh server from within your terminal, too.
Get Started With pastes.sh on Linux
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 pastes.sh. You will need to create a new SSH key with the Ed25519 algorithm:
ssh-keygen -t ed25519 -C 'your_email@example.com'
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 pastes.sh SSH server with:
ssh new@pastes.sh
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.
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 pastes.sh to Create Pastes From Your Terminal
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 pastes.sh, 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/* pastes.sh:/
…or you can send files individually with:
scp thisfile pastes.sh:/
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 pastes.sh
…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 pastes.sh foss
The above command will generate a file named foss containing the text ‘Open source 4 eva’, accessible through ‘your-pastes-url.sh/foss’.
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.
Reference: https://www.makeuseof.com/share-text-using-pastebins-from-linux-terminal/
Ref: makeuseof
MediaDownloader.net -> Free Online Video Downloader, Download Any Video From YouTube, VK, Vimeo, Twitter, Twitch, Tumblr, Tiktok, Telegram, TED, Streamable, Soundcloud, Snapchat, Share, Rumble, Reddit, PuhuTV, Pinterest, Periscope, Ok.ru, MxTakatak, Mixcloud, Mashable, LinkedIn, Likee, Kwai, Izlesene, Instagram, Imgur, IMDB, Ifunny, Gaana, Flickr, Febspot, Facebook, ESPN, Douyin, Dailymotion, Buzzfeed, BluTV, Blogger, Bitchute, Bilibili, Bandcamp, Akıllı, 9GAG