Skip to content
July 18, 2011 / thebengaliheart

Kpaste – a friend for the lazy

I often work on vi, and also do a lot of work through the konsole. At such times, selecting the entire code, copying it, and pasting it on seems like … uhm… too much work. The plasma pastebin applet offers a nice alternative, it has support for multiple backends(even image uploads). But even then, i have to select the text and drag-drop it on the applet. Most often, its a trouble to do this with text from konsole. Also, its too much work to use a mouse (I know there are people who are as lazy as me, and find typing letters at the keyboard easier than playing with the mouse πŸ™‚ ).

Without further ado, I present KPaste, a simple command-line tool to paste to It supports both GET and POST, clipboard input and output, automatic retries, and a little syntax detection (if you are pasting files).
Use it like
$ git diff | kpaste
this pipes the output of git diff to kpaste
$ kpaste abc.cpp -x
this pastes abc.cpp (while correctly detecting syntax from filename), and prompts for a password for the paste(-x does it).
$ kpaste -i -o
this will paste your clipboard, and give the url back to your clipboard.

you may paste text directly like this …

$ kpaste -l python

I just started with it, so I am sure it has many bugs. Would be great if everyone tests it out and helps with the code. I also plan support for multiple paste backends, but at the moment, is hardcoded into it. I also need translations and documentation (a man page), so anyone offering to help is most welcome. Not to forget, a large part of the functionality and code is influenced by the fpaste tool by FedoraUnity used for posting to
Thanks in advance for help with coding, testing, documentation and translations, or just rendering it useful by assimilating it as a tool for your work routine. Just let me know if it made your day πŸ™‚

Edit: As pointed out by estan, I forgot to mention where the code is πŸ˜‰


Leave a Comment
  1. estan / Jul 18 2011 5:01 pm

    You forgot to say where the code is πŸ˜‰

  2. Martin Klapetek / Jul 18 2011 5:35 pm

    I personally like pastebinit, which also has as a possible backend and the work with it feels more natural in console works, ie. “cat myfile.cpp | pastebinit” and it will simply output the link. You can set some options too and have a config file with default options too (hint hint).

    • thebengaliheart / Jul 18 2011 7:49 pm

      yes it was a little while after i posted this that someone told me about pastebinit.

      • Martin Klapetek / Jul 18 2011 10:53 pm

        Actually I put in a wrong example, what is pastebinit really usefull for is “git diff | pastebinit”. If you could make KPaste work like that, that be total win πŸ˜‰

  3. thebengaliheart / Jul 19 2011 3:28 am

    Yep. KPaste already works like that. it allows piping to and from std(out|in) and also to and from your clipboard πŸ™‚

  4. salout / Jul 20 2011 4:14 am

    Looks like this piece of code has to be reinvented again and again. I wrote my script (for in March 2010.

    I created even a video explaining how to make use of Klipper actions. πŸ˜‰


  1. Links 20/7/2011: Ubuntu 12.04 LTS Release Schedule, Linux-powered HP TouchPad Competitive With iPad, New OLPC Surfaces | Techrights

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: