Wgetpaste – Upload Directly to Pastebin from the Linux Shell

If you use pastebin as much as I do then you will think this tool is as cool as I do. Pastebin is a online site which allows users to copy and paste snippets of code in order for share them with other people and get feed back.

In Linux circles its commonly used for posting error logs or some other sort of problem so that other users in a IRC (Internet Relay Chat) channel may view to problem and perhaps offer suggestions. There are many sites like pastebing including dpaste and pastie to name a few. So why should your care about this? Well in many situations you may be not be able to do a simple copy and paste from your servers logfiles or you maybe in some other sort of terminal to terminal situation. The example I will use is this:

At some time Xorg during its update process can break the X session in your distro. Many times users will be unaware and use their package managers to update to the newest version, then when they go to log in to X they get a crash, or no screens found or some other sort of error. In such situations the user may go to the IRC channel of their Distribution and ask for help. When the other users in the channel say “pastebin your Xorg log” the poor guy will say to himself, “How the *heck* am I going to do that”. Well wgetpaste is the answer. Its a breeze to install, the source is available here.

The usage is very simple:


All we are doing here is outputting a log file with whatever arguments we need in to wgetpaste. Going back to the Xorg example I used the cat command to read the Xorg log file, I then used tail with the -n switch which defines the number of lines I want to use, and then piped that in to wget paste. Wgetpaste then chooses from a random list of sites and posts to whichever one it chooses. Now you can simply give the link to whoever needs it in order to review your error. The resulting post on the dpaste site would look like this: