Use pastebin from command line

Use pastebin from command line

Quite often, when you have a problem where, in order to get help you need to paste the contents of a file,or command output so that it can be shared, for example on IRC (Chat) or a forum, this can be challenging to begin with.

As it is depreciated that you paste more than 2 lines in to IRC chat. The way round this is to use a service called pastebin. Debian [1] has it's own service for this [2]. There is a tool called pastebinit which is really helpful from the command line.

The first step is to switch to the root user. Sear for and install the package pastebinit as per below.

Search

root@Desktop:/home/user# apt search pastebinit
Sorting... Done
Full Text Search... Done
pastebinit/stable 1.5.1-1 all
  command-line pastebin client

Install

root@Desktop:/home/user# apt install pastebinit
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-image-5.10.0-7-amd64 linux-image-5.10.0-8-amd64
Use 'apt autoremove' to remove them.
The following NEW packages will be installed:
  pastebinit
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 46.6 kB of archives.
After this operation, 342 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 pastebinit all 1.5.1-1 [46.6 kB]
Fetched 46.6 kB in 0s (342 kB/s)
Selecting previously unselected package pastebinit.
(Reading database ... 190310 files and directories currently installed.)
Preparing to unpack .../pastebinit_1.5.1-1_all.deb ...
Unpacking pastebinit (1.5.1-1) ...
Setting up pastebinit (1.5.1-1) ...
Processing triggers for man-db (2.9.4-2) ...
root@Desktop:/home/user# 

Once complete switch back to normal user (usually type exit)

user@Desktop:~$ cat /etc/apt/sources.list > pastebinit
user@Desktop:~$ cat /etc/apt/sources.list | pastebinit
https://paste.debian.net/1228146/

In this example I have used the cat command and piped the contents in to pastebinit, this has given me a url to paste in to chat, (or copy manually)

Open this in a browser and you and others can see the contents, and people can help you further.

paste bin it output

This is really useful too if you are stuck at the command prompt, without a graphical interface.

Links

1 Debian 2 pastebin – debian 3 Paignton Library STEM Group TAGS

#Debian,#GNULinux,#Paste,#Text,#Pastebin,#Share,#Troubleshooting


Donate using Liberapay

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License


MastodonPeertubeQoto sign up

Donate using Liberapay