How to use fpaste to share problem reports

If you use or develop software, you will inevitably run into problems. When these problems arise, you end up needing to share error messages, command output or the contents of files with people online. An online content-sharing tool is often called a pastebin. Luckily within the Fedora ecosystem, we have our own tool to do just that: fpaste. fpaste is both a web-based pastebin and a command line tool. fpaste is a lifesaver for debugging errors or simply looking for feedback on some text.

Getting started

How do you get access to fpaste? There are two methods; first we’ll look at the website.

To get started with fpaste, just go to the fpaste.org website, copy your error, paste it into the input box, and hit submit. The resulting page has the URL you can send to your fellow debuggers. The web user interface has options that allow you to:

  • set the syntax of the paste,
  • tag the paste with your alias,
  • mark it private (including requiring a password), and
  • set a self-destruct timer on the paste.

While the website’s great, the command line tool is where the real awesome lives. It makes it trivial to paste files or output from a command. It’s an extremely valuable tool for troubleshooting and reviews. First off, let’s get it installed. Use this command:

sudo dnf install fpaste

Once it’s installed, try pasting something!

echo "This is a test paste." > ./testpaste.txt
fpaste testpaste.txt

After that, fpaste presents you with two URLs, one short and one long. The short URL is great for something like Twitter, but I tend to use the long one for everything else. Remember all the great options you were presented with in the web UI? The local client provides access to all the same features.

Want to password protect your paste?

fpaste testpaste.txt -d "my super secret password"

If you want to see all the options fpaste has to offer, check the man page.

man fpaste

fpaste your output

While pasting files is nice, sometimes the stuff you need to paste isn’t a file, but output from a command. Luckily, fpaste handles redirected output really well.

What are output redirects, you ask? Output redirects allow you to use the output of one command as the input to another. For example:

ls / | grep home

The command ls lists all the directories in a location. Grep searches through input and returns lines that match what you’re searching for. So, the above command will return home, since it was a match. The “|” operator is known as the “pipe.” It allows you to “pipe” output from one command to another. Suppose you want to find out what graphic card your machine has. You can run:

lspci | grep VGA

You should see some output similar to:

01:00.0 VGA compatible controller: NVIDIA Corporation GM206 [GeForce GTX 960] (rev a1)

Although this output is small enough you could easily just paste it directly into IRC, you could easily pipe this output to fpaste.

lspci | grep VGA | fpaste

This would then send that output to the Fedora pastebin. Neat, right?

But what if I need to paste a lot of info about my machine, you say? There’s a flag for that!

fpaste --sysinfo

This will paste a broad overview of the current state of your system. Everything from the hardware you have to the top 5 CPU hogging processes will show up in this paste – which is really helpful for debugging whatever issues you might be having. You can use fpaste anywhere you might be looking for help: ask.fedoraproject.org, reddit, stackexchange, email, IM or IRC.

fpaste all the data

Some commands or utilities might still send some output to the terminal. This is often because the command is producing both standard output, or stdout, and standard error, or stderr. These outputs are often separated to allow sending useful data to one place, and logs or error messages to another.

If you want to paste the output of the command and be 100% certain you captured all the output (from stdout and stderr), use the “|&” operator. This operator takes all the stderr info and adds it to the generic stdout output, ensuring you can paste every last bit of debug information you need. There’s a lot you can do with output redirection. Check out this bash scripting tutorial to get ideas for what you can do.

Hopefully this short tutorial helps you out in the future. As a member of the QA team, I use fpaste numerous times a day. If you’ve never used fpaste before, take some time to experiment with it. For those of you who use fpaste, please mention how you use it in the comments. It’d be great to see all the ways the Fedora community uses this awesome tool!

Fedora Project community

10 Comments

  1. klaus

    Why on erath do you use a whit/grey-ish box over the text. It’s completely unreadable.
    |<

  2. What is the difference between https://fpaste.org/ and http://paste.fedoraproject.org/ … is it the same thing? Is one being deprecated? Why do we have two of them?

  3. kom

    I tried to share a README that I wrote through the fpaste web interface. I’ve got the following error : “Your paste contains a phrase that has been censored”.
    Maybe should you give us a more complete error message. Or at least the line where it occurs.

  4. Jan

    https://fpaste.org

    fpaste.org uses an invalid security certificate. The certificate is only valid for the following names: *.fedoraproject.org, fedoraproject.org (Error code: ssl_error_bad_cert_domain)

  5. Cody

    Maybe I’m just being critical, I don’t really know, but isn’t:

    `ls / | grep home’

    really a terrible way to demonstrate the pipe, when you can just as well do:

    `ls -d /home’

    and explain it (the pipe) some other way ? (I.e. don’t teach redundancy or useless commands – just like cat file|grep text is useless)

    And shouldn’t grep really be in lower case like the command is (as it should be) even in the beginning of a sentence ? Whether you believe it or not, case does throw many people off – especially if they’re used to an OS (or even a specific interface) that doesn’t care about case. And just like the cited example as to why not include the full stop (‘.’) in quotes at the end of a sentence[1], the same goes for starting the sentence with the incorrect case (if it involves something that is case-sensitive).

    [1] The classic example is explaining the ‘.’ command in vi (and vim) and how one might type it because it in the quotes (just like they type everything else in quotes in said documentation). Yes, people do try to use the wrong case because they think it doesn’t matter. If you have to capitalise the beginning of the sentence then you could reword it so that the command isn’t the first sentence.

    Call me crazy (I wouldn’t deny it but for different reasons), but the above isn’t imagination – it is realistic. Just some thoughts…

    • Cody, those are some good points. I used the simplest example of a pipe I could think of. You’re right, that command is pretty useless. It was just a simple means of showing the output of one command going into another – sure there are other more elegant ways to accomplish that specific result (as with most things in the *nix world), but it serves as a decent example I think.

      As for the capitalization of “grep,” I followed the capitalization of the GNU Grep page [0].

      Thanks for your feedback!

      [0] http://www.gnu.org/software/grep/

Comments are Closed

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions