A little habit: cat >/dev/null

September 30, 2009

If you were to haunt me, every so often you would see me open up a new terminal window, run 'cat >/dev/null', and paste or type something there.

What I am doing with this peculiar behavior is simple: I'm arranging for a slightly more persistent text storage than my X selection. I park any number of things depending on what I'm doing; snippets of text from fishing back in editor undo, commands that I'm temporarily re-running, and so on.

There's nothing particularly special about cat in a terminal window for this. There's any number of other programs and ways that I could do this; it's just that this way is the fastest and most convenient in my environment. Your environment is probably different, especially if you keep an editor going all of the time (if I always had Emacs running, I'd probably just paste things into a scratch Emacs buffer).

(In theory xclipboard should be ideal for this. In practice it sadly doesn't work out, partly because its version of cut & paste is significantly worse than that of terminal programs.)

Note that in some ways using a terminal window is a bad idea. I always have to make sure that any tabs are unimportant, because they're probably going to turn into spaces by the time I paste the text back into its eventual destination.

(I would really like an X terminal program that was smart enough to preserve tabs, but I haven't run into one yet.)

Comments on this page:

From at 2009-10-01 04:28:08:

rxvt-unicode can optionally preserve tabs (see the pastableTabs resource). However, in this mode the cursor placed on a tab character becomes very wide, which can be visually unpleasing.

-- Sergey Vlasov

Written on 30 September 2009.
« On (not) putting IP addresses in registration email
The rules for combining things with Bourne shell 'here documents' »

Page tools: View Source, View Normal, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Wed Sep 30 23:02:38 2009
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.