Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Are there any command line tools on Linux that allow you to post output from commands or text files directly to a sharing service such as pastebin.com?

share|improve this question
My favorite, when paired with a nice shell script, is Sprunge. – DopeGhoti Jan 9 '14 at 5:19
up vote 17 down vote accepted

There are several services that provide this but 2 that are pretty easy to use from the command line are fpaste and pastebinit. These 2 tools link to the sites, paste.fedoraproject.org and pastebin.com.


NOTE: This is a Fedora/CentOS/RHEL only option

If you're using any of the Red Hat based distros you can install the package fpaste which gives you a command line tool for posting content to paste.fedoraproject.org.

Basic commands

For basic posting of a single text file you can do the following.

$ fpaste hello_unixnlinux.txt 

The above command will return a URL where your content can now be accessed by others.

Uploading (0.1KiB)...
http://ur1.ca/gddtt -> http://paste.fedoraproject.org/66894/89230131

Other commands

There are of course a whole host of other options.

  • paste clipboard: fpaste -i
  • paste sytem info: fpaste --sysinfo
  • dry run: `fpaste --printonly somefile.txt

See the man page, man fpaste for more details.


This is probably the more popular of the 2 tools. It's supported on most of the distros I frequent such as Fedora, CentOS, and Ubuntu just to name a few. It has similar features to fpaste but, you can do a whole lot more with it, for example:

list of services

For starters we can get a list of all the "supported" URLs via the -l switch.

$ pastebinit -l
Supported pastebins:
- cxg.de
- fpaste.org
- p.defau.lt
- paste.debian.net
- paste.drizzle.org
- paste.kde.org
- paste.openstack.org
- paste.pocoo.org
- paste.pound-python.org
- paste.ubuntu.com
- paste.ubuntu.org.cn
- paste2.org
- pastebin.com
- pastie.org
- pb.daviey.com
- slexy.org
- sprunge.us

If you don't bother to select one using the -b switch, it will pick one based on your distro, assuming there's one for it, otherwise falling back to pastebin.com. Notice it also supports fpaste.org, for Fedora, so you could use this tool to cover that pasting service as well.

Posting a simple text file

To post a sample file to pastebin.com.

$ pastebinit -i hello_unixnlinux.txt -b http://pastebin.com

Posting code

You can also tell that the content you're pasting is code using the -f switch. For example here's a Bash script. We're also going to name the upload using the -a switch, so that it will show up with the name "ex_bash_1".

$ pastebinit -i sample.bash -f bash -a ex_bash_1 -b http://pastebin.com

A full list of syntax's supported, is covered in the pastebin.com FAQ under this topic titled: For which languages do you offer syntax highlighting?.

For further details be cure to check the man pages, man pastebinit.


Here are 2 examples of the file that I posted to each service.

fpaste - http://ur1.ca/gddtt

   ss of fpaste

pastebin - http://pastebin.com/jGvyysQ9

   ss of pastebinit


share|improve this answer
All of these pale in comparison to Sprunge and Hastebin, IMO. (: – DopeGhoti Jan 9 '14 at 5:20
Yes I hear about how awesome Sprunge is, BTW never heard of it until today. There website is like /dev/null, and i find the interface awkward vs. an actual tool such as the ones that I've listed. But that is why we have so many options, so that everyone can pick what they like 8-). Hastebin on the other hand seems a bit more polished, I like that you can host your own instance, the duration of 30 days max is a deal breaker for me. – slm Jan 9 '14 at 5:34
Also notice that pastebinit can post to sprunge.us. It's in the list provided by pastebinit -l. – slm Jan 9 '14 at 5:35

I like the two command line tools that use curl, listed on the Arch Wiki:

<command> | curl -F 'sprunge=<-' http://sprunge.us

<command> 2>&1 | curl -F 'f:1=<-' ix.io

You can make a simple function to save you having to remember the gory details, like so:

sprung() { curl -F "sprunge=<-" http://sprunge.us <"$1" ;}

You can send to an enhanced URL if you would like syntax highlighting for your code paste. For ix, you append either /ID/ to the URL (http://ix.io/ID/) for default syntax based on auto-detection, or /ID/<language>/ to explicitly set the language for pygments highlighting.

For http://sprunge.us, append ?<language> for the same effect.

share|improve this answer
Can you style those or select a code type or is the syntax highlighting, if any, automatic based on what's pasted? – slm Jan 9 '14 at 5:37
Not that I am aware of: it just pastes text. But I have not looked any further into it as that is all I need. – jasonwryan Jan 9 '14 at 5:43
Very good, I just wasn't sure if there was more to the curl interface in terms of extra switches etc. that you could include in the request. – slm Jan 9 '14 at 5:45
I found it. You can tack on a ? followed by the name of the langugae to get highlighting and line numbers. See this example: sprunge.us/MFMY?bash – slm Jan 9 '14 at 5:52
simply the best and most simple solution out there. Love archlinux community :) – nXqd Apr 11 '15 at 8:36

I needed something to share terminal output even when X server wasn't loaded so I created this service: termbin.com. The only thing you need is netcat, then you can easily share with anyone anything that can be shown in terminal, there's example:

cat /etc/fstab | nc termbin.com 9999

After running this command you'll get in response url address with text file.

To make your life easier you can add such alias to your .bashrc file:

echo 'alias tb="nc termbin.com 9999"' >> .bashrc

Now sharing will be much simplier:

uname -a | tb

You can get saved ones for example by using curl. You'll find more examples on termbin.com.

You can host your own server as well, there is github repository: https://github.com/solusipse/fiche. If you want to make it private, don't forget to set whitelist parameter.

share|improve this answer
There is also pastebin-cli, and Welcome to U&L.SE – eyoung100 Sep 10 '14 at 22:24
@solusipse; how long the paste will remain on your server. could it be forever? or is there a link to remove the posts – r004 Nov 9 '14 at 23:23

I use clitxt as no account is required, and there are no parameters or settings to remember. You just pipe the command to clitxt and it returns a URL. e.g.

root@server3219-old7 [~]# yum -y update | clitxt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.