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?

  • 3
    My favorite, when paired with a nice shell script, is Sprunge.
    – DopeGhoti
    Jan 9, 2014 at 5:19
  • Check out https://paste.c-net.org/ It comes with Bash functions, easily usable from the command line with no extra programs to install. Well, except for curl, which you probably have anyway :)
    – bolt
    Mar 11, 2019 at 15:50
  • Is there a self-hosted way to get the paste.c-net.org functionality?
    – frakman1
    Apr 17, 2021 at 4:28
  • There's Haste, a opensource pastebin type app - github.com/seejohnrun/haste-server. It's written in Node.js @frakman1
    – slm
    Apr 17, 2021 at 23:07
  • I am a bit late to this post, but I created a little tool to help with this. pasteshell.com Feel free to check it out and let me know what you think. May 15, 2021 at 14:13

10 Answers 10


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


  • 1
    All of these pale in comparison to Sprunge and Hastebin, IMO. (:
    – DopeGhoti
    Jan 9, 2014 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, 2014 at 5:34
  • Also notice that pastebinit can post to sprunge.us. It's in the list provided by pastebinit -l.
    – slm
    Jan 9, 2014 at 5:35
  • Please add a note that the example pastebinit command uses your local username as the paste title, that was an unpleasant surprise
    – Dubslow
    Dec 14, 2017 at 19:08

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.

  • 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, 2014 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, 2014 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, 2014 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, 2014 at 5:52
  • simply the best and most simple solution out there. Love archlinux community :) Apr 11, 2015 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.

  • There is also pastebin-cli, and Welcome to U&L.SE
    – eyoung100
    Sep 10, 2014 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, 2014 at 23:23
  • 1
    @r004 As they mentioned in termbin.com "Life span of single paste is one month. Older pastes are deleted." Jun 2, 2017 at 8:49
  • Very interesting, but useless if you are behind a firewall with port 9999 blocked. Using nc -v you'll get nc: connect to termbin.com port 9999 (tcp) failed: No route to host.
    – Pablo A
    May 23, 2018 at 4:49
  • I tried to use your tool and unfortunately for my use-case, due to the file size limit, it was useless. You should probably mention that there is a 1 MB limit. I have tried to copy a log of 2868178 bytes and only the first 1MB got transferred. Mar 4, 2021 at 12:34

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

Many pastebins don't require any special tools. curl or wget will do.

https://paste.c-net.org/ is one such example.

Here's a snippet from the "manual":

Upload text using curl:

$ curl -s --data 'Hello World!' 'http://paste.c-net.org/'

Upload text using wget:

$ wget --quiet -O- --post-data='Hello World!' 'http://paste.c-net.org/'

Upload a file using curl:

$ curl --upload-file '/tmp/file' 'https://paste.c-net.org/'

Upload a file using wget:

$ wget --quiet -O- --post-file='/tmp/file' 'http://paste.c-net.org/'

Upload the output of a command or script using curl:

$ ls / | curl --upload-file 'http://paste.c-net.org/'

$ ./bin/hello_world | curl --upload-file - 'http://paste.c-net.org/'

You can also simply pipe stuff to netcat

$ ls / | nc paste.c-net.org 9999

Unlike termbin, paste.c-net.org won't time out if your script takes more than 5 seconds to produce its output.

$ { sleep 10; ls /; } | nc termbin.com 9999
$ { sleep 10; ls /; } | nc paste.c-net.org 9999


The page also provides premade Bash functions for your .bashrc file.


I wrote this website specifically made for pasting through by curl, since I felt no one should have to remember specific syntax like in sprunge. It's also not only open source, but completely portable so you can easily set up your own "curlpaste" with any other domain. i.e. a private paste server.

curl --data-binary @your-file-here.txt https://curlpaste.com

if you visit the website there is also a web interface that provides other options like read once and delete.


Here is another service that seems to offer this: https://ctrlv.link/

Add the code in a file input.txt and run this command from a terminal window:

$ curl --form "expiration=0" --form "code_type=nohighlight" \
     --form "content=<input.txt" https://ctrlv.link/insert.php

An example with C/C++ code (test.cpp):

$ curl --form "expiration=0" --form "code_type=cpp" \
     --form "content=<test.cpp" https://ctrlv.link/insert.php`

I recently created one command line tool for the pastebin https://notepad.pw/ I use frequently

pasting your file is as simple as

npw -lo filename linkpath

so basically it pastes the content to https://notepad.pw/

The l flag is for live update asin if someone else is viewing the page the page will update without reloading.

the 'o' flag is for overwrite if you don't use it, the content will be appended to the existing one.

You can install the tool via pip

using the command.

pip install npw

Here is the github page.



disclaimer: This is my own project

Anypaste supports about a dozen pastebin-like services currently (most notably Hastebin and ix.io). You can pipe something in some_command | anypaste or explicitly list a file anypaste my_code.c. Media upload is also supported to sites like Imgur and Gfycat; anypaste automatically detects file type to determine where to upload the input.

The quickest way to install is to download the executable (it's a big shell script):

sudo curl -Lo /usr/local/bin/anypaste https://anypaste.xyz/sh

  • I noticed that it posts to tinyimg.io. Is there a way to have it self-hosted so the content is on my own website?
    – frakman1
    Jan 30, 2021 at 20:58
  • There's a plugin system documented on the website; you could add a plugin that uses scp or rsync to upload to your own server. However, it will probably be easier to just an an alias for scp or rsync to your .bashrc file than to use Anypaste. Jan 31, 2021 at 1:24

Based on this answer, I wrote the following script which reads from STDIN (or assumes output it piped into it).



curl -d "api_paste_code=$(jq -sRr @uri)" \
     -d "api_dev_key=$api_key" \
     -d 'api_option=paste' 'https://pastebin.com/api/api_post.php'

echo  # By default, there's no newline

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