Pasting code or other text is so common that there's an insane amount of paste sites available and while they all have their strength, the majority of them rely on their web interface to post the code required and/or pack some additional metadata that I don't particularly care for. (filename, filetype, etc..)
I've used many of them throughout my career daily, but none of them really stuck as the one goto paste tool. The three I've used most are:
Gist remains the one I use if I want to keep track of the pastes I make
and manage them as a repository in their own right. However, not every paste I
make needs to be persisted, most are just one-off and can be left to rot, which
it not what I'd like my
Gist page to contain.
I live in the terminal. My entire development workflow revolves around having the terminal open the entire time and that terminal occupying my entire desktop space; now while it may be possible to still use these tools, I simply needed something small, available as a command line interface with as little noise as possible all the while being able to either paste and throw away or keep them combined under a specific alias for future use. Several months back I was introduced to ix.io and that remains for now, my paste tool of choice.
ix.io is a command line pastebin, plain and simple. It provides you with the
ability to create pastes from the command line which in turn gives your other
terminal applications the power to do the same.
ix.io uses curl as the communication client and thus
uses HTTP with a somewhat restful approach to managing pastes. This is quite
apparent from their main page. Let's see how it works, we will be using
the client available on the official site which is
a simple, yet powerful script.
First off, make sure you have
curl installed, this is a hard requirement for
the client script.
Next download the client script by first inspecting the client code (make sure you get into the habit of doing this) and then running the following:
% curl ix.io/client > ix % chmod +x ix
N.B. Everything from here on out assumes that
ix is available in your path
so you'll have to either ensure it's there or replace any occurance of
Let's get dirty!
All you need to do is run the
ix command by itself.
% ix ^C to cancel, ^D to send. class Foo(object): def bar(self): self.stuff() http://ix.io/mac
This will prompt you to type multi-line text and simply send using
or cancel using
^C (CTRL+C). (Tip:
^D should be on a new line and doesn't
need a following
The result of your paste will be a URL with a random ID that you can open in order to get the pasted text.
Most commonly you would use one of the following methods in order to paste:
% ix somefile.txt % echo "some text" | ix % cat some file1 file2 | ix % run_some_command | ix
Who needs a browser? Since we're in the terminal, let's just stay there!
% curl http://ix.io/mac class Foo(object): def bar(self): self.stuff()
One of my personal favorite features of
ix.io is the ability to get highlighted
text right in the terminal.
% curl http://ix.io/mac+python
Don't believe me? See for yourself:
You can achieve the same result by appending
/python to the URL and opening
it in the browser.
ix.io also allows you to store your pastes under a user. It uses
means to identify who you are with respect to the
ix.io host. In order to
create a user, open
~/.netrc in your favorite text editor and add the following:
machine ix.io login user123 password pass456
The authentication method is HTTP
Basic Auth so don't use any important
ix.io would now look at your credentials every time you run the
and if it doesn't find your user, it will create it during your first paste.
You can now also view your available pastes at
there's no way to get plain text out of that URL, so you have to either do that
in the browser or parse the resulting markup.
By having a user you can now also update your own pastes:
% ix -i ID ...
Or even deleting your own pastes:
% ix -d ID
It really depends on the text editor's way of invoking external commands. You will have to consult with the respective tools' documentation. I can offer suggestion on how to paste from the following tools:
Emacs Install the following plugin and use:
Vim Place the following in your
noremap <silent> <leader>i :w !ix<CR>
\i on a buffer or a visual block, where
\ is the default leader
(replace it with your configured leader key). Below is a sample of the Vim
Copyright 2018 aboumrad.info - licensed under CC BY-NC-SA