Yesterday morning I had a bit of a strange question (so I thought), although it turned out to be a good one. “Is there any way to pipe or redirect output from the console to the clipboard?” I asked my good pal jdong if there was indeed a way to do this. He quickly turned me onto this Debian page where I discovered a neat little application called xclip.

You can read the nuts and bolts of its usage on the Debian page, but it’s quite easy. I’ll use an example based on what I originally wanted it for (being able to paste file listings of various directories into a pastebin or document):

ls -al /media/storage2/Comedy/* | xclip

You can retrieve what went into the “clipboard” by running xclip -o, which will paste back into the terminal whatever you copied using the example above.

Unfortunately what it did not do was save the output to the regular “X” clipboard (where items normally go when you highlight and do a Ctrl+v or Ctrl+x in the GUI or Ctrl+Shift+c/x in the console), which is what I was expecting, but this is easily remedied. In order to do that, we must run the following:

ls -al /media/storage2/Comedy/* | xclip -selection c.
(To paste from the X clipboard it’s simply a matter of running xclip -selection o, but you can also just use Ctrl+Shift+v)

xclip supports a lot of extended features such as split clipboards (which I’m still not quite sure what those are), but I mainly wanted to use it for grabbing file listings. So all I did was make an alias by running:

alias xclip='xclip -selection c'

Now when I pipe output to xclip I can quickly switch to my web browser or document, hit Ctrl+v and my console output appears in a pastebin or whatever else i’m working on. It’s quite handy for both writing technical documents and for troubleshooting. Pastebin is the darling of IRC idlers, and this just made it easier.

I didn’t bother with aliasing “xclip -selection o” simply because I can just use Ctrl+Shift+v and paste back into the console from the X clipboard as mentioned above.

Hopefully that wasn’t too confusing. Use it a few times and it becomes a lot more intuitive. I certainly like it, especially for large outputs that would exceed the scrollback buffer (I use the Awn Terminal Applet constantly, which has a small buffer).


While Ubuntu does a very good job providing graphical alternatives to traditional console applications and utilities, I remain a staunch proponent of the console, as those who know me can attest. I could even go as far as saying that I’m a “zealous proponent” of the console, but I do use plenty of graphical applications, whether for aesthetics or for ease of use or for functionality. I don’t particularly favor one or the other.

However, in many cases, the console is much, much faster if you know what you’re doing. A friend of mine said to me just tonight, “you have a tendency to insist CLI is better just because you’ve spent the time learning how to use it.” He’s exactly right. I’ve spent countless hours reading man pages, howtos, tutorials and change logs because I realized early on in my UNIX-like OS “career,” that the console could open up some very powerful opportunities for me if I only took the time to learn how to use it effectively.

Older hardware can also benefit immensely from a console-heavy environment, although it need not be entirely text-based. But when you have a 300MHz Pentium II with 128MB RAM you probably don’t want to run a full GNOME desktop, Azureus and Amarok. But with command line utilities and a bit of know-how you can still use that machine very effectively (I even had good success selling PII 300MHz with 128MB RAM and Windows XP as “web/email laptops” in 2004, so imagine what you can do with a bit of Linux console magic!) .

Some of my favorite console applications, both old and new, include irssi, the IRC client I absolutely cannot live without, rtorrent, mplayer, screen (which is incredibly powerful and useful when combined with other CLI apps), finch and, of course, ssh. We’ll explore these and others in a series of article I intended to write and I’ll do my best to provide links to the wealth of other sites that provide much better articles than I ever could. I hope to learn a lot more myself during the process, so you won’t  be going it alone!

I am not a console expert. I’ve only been using Ubuntu for just over 16 months, although I did mess around with several versions of Red Hat in the late 1990s, when Linux did not support internal modems much at all, and I didn’t own an external serial modem. Somewhat ironically, I became reintroduced to the console courtesy of Mac OS X which I began using in 2005 and by the time I began using Linux again in earnest I was hooked. Now I know enough to get around in the console of most Linux distribution, BSD and Solaris. But I have much, much more to learn.

So stay tuned for several updates per week in which I investigate new console applications and utilities. You’ll be a “console snob” in no time! 😛

Tom Baker, a self-described “hardcore Windows fan” and, presumably, the Fourth Doctor in the BBC’s long-running (since 1963) science fiction series “Doctor Who“, began using a LiveCD of Ubuntu GNU/Linux 7.04 “Feisty Fawn” and, of course, he liked it. The author’s ignorance of UNIX-like operating systems does show through in places but I don’t mean that as a disparaging remark at all — he made the effort. The author begins by telling us how great Windows is:

Say what you want about Microsoft, it powers the world. I can use any hardware, play any game and use nearly any software ever written. I can do it securely, and with little frustration.

I certainly disagree with this because even Vista, with its many security improvements (I’m not being facetious), retains gaping holes through which intruders can exploit your system and the prying eyes of our friends at Langley and Fort Meade can take a peek. Every piece of hardware is far from running flawlessly on Vista. Significant amounts of hardware, including printers, simply do not work with Vista. Other times, the drivers merely negatively impact the performance (in the case of video cards).

Nearly any software ever written? Not by far, lad. A quick visit to SourceForge showed that there are 152,864 projects registered, most of which are not written to run on Windows platforms. And not all of our software, whether free or “open source,” is registered as a SourceForge project. And while using Vista may not be frustrating for him, it is for me. Bugs, crashes, quirks (such as XP shares not showing up in Vista, but Vista shares working properly in XP) and all manner of “Redmondism” plague Vista, not least of which is a barely functional command line shell. Sorry, Bill, not all of us need a cute little picture and a cursor to get the job done.

Patently untrue or not, his opening comments do set the stage for his final report. He had some trouble getting onto his wireless network (secured with WEP) and had some issues with codecs and getting the proper screen resolution. I couldn’t help but thinking “why not just do a dpkg-reconfigure -pmedium xserver-xorg?” The experience of a free, UNIX-like OS certainly does rub off on you once you get comfortable running in terminal, which is where I tend to spend most of my time these days (whether downloading with hellanzb or rtorrent or ussing irssi for IRC chat).

After he decides to install the OS, he has the following to say:

I’m writing this on my newly installed version of Ubuntu. I can honestly say it was a piece of cake getting it up and running. I had to do a few things first, like create some partition space on my hard drive to install Ubuntu on. Lucky for me, Windows Vista has a handy new “Shrink” command to shrink the size of your partition. Thanks to that, I was able to free up about 9 Gigs to devote to Ubuntu.

I can’t help but get a kick out of him extolling the virtues of Vista’s “handy new ‘Shrink’ command.” Many of us have been using gparted, whether from a GNU/Linux install or from a LiveCD, for a long, long time (or qtparted for you KDE types). He concludes by saying that he thinks it is unlikely that Ubuntu will ever replace Vista for him, but admits that he “just likes Vista, warts and all.” To each his own, as they say.

Bottom line, I was pretty heartened to see a self-described Windows zealot describe his initial (positive) reaction to Ubuntu 7.04 which, he says, “lives up to the hype.” Even though I maintain my position that UNIX-like operating systems, free though they may be, are not suitable for many end-users, I think power users and “admin-types” such as this fellow have a definite place in our community. It’s important to remember, however, that the important part of our community is not the fact that we use GNU/Linux – it’s the fact the we use free software.

You can find the full text on his blog.

Partly to alleviate boredom and partly to force myself to get back in the habit of writing more, I’m presenting and commenting on some of the tech and freedom stories that I found interesting this week:

  1. Stylish Add-on For Firefox
    First on the list is the incredibly cool Firefox add-on called “Stylish.” What stylish essentially does is apply third-party CSS code to various websites, bringing them in line with your personal tastes and/or desktop themes. Another blog post on mashable.com yielded a comprehensive overview of some of the scripts available for Stylish on userstyles.org (many of them are also available for both Greasemonkey and Opera), including this gorgeous rewrite of Google that I now use (easily localized, too). Have a look around at UserStyles and see what catches your eye.
  2. “Gran Paradiso Alpha 6” (Firefox 3) Released
    There is not much I could write that our friend Matt Hoy didn’t already write over at his blog, MBHoy.com. Firefox Alpha 3, codenamed “Gran Paradiso,” has been released. I haven’t begun to use it myself, preferring to keep all of my plugins and add-ons intact, but word has it that the new Firefox has stopped leaking memory like a sieve, weighing at under 100MB even with over a dozen tabs open. For someone like me who usually keeps 3-4 browser windows, each with 8-10 tabs open, across multiple workspaces, this is very good news indeed.
  3. Gobuntu Announced On Shuttleworth’s Blog
    Mark Shuttleworth, founder of Canonical, Ltd. and financial backer of the Ubuntu GNU/Linux distribution has announced a project called “Gobuntu” which will focus on stripping out every piece of software that is not “free,” i.e. freely modifiable and redistributable. “We are trying to apply the FSF ‘rights’ definition to everything in the platform,” said Shuttleworth in an update to his blog posted Tuesday. As a staunch supporter of software freedom and of the Free Software Foundation (FSF) I certainly applaud this. One of the major drawbacks, however, is that a lot of popular formats and technologies (including PDF, MP3 and Flash) are anything but free, with either serious patent issues (MP3) or being downright closed technologies (PDF and Flash, both Adobe products). Shuttleworth addresses this saying, “This means that we try to strip out ANYTHING which is not modifiable and redistributable, including firmware, PDF’s, video footage, sounds etc” and goes on to explain that “Gobuntu will not correctly enable much hardware today – but it exists as a banner for the cause of software freedom and as a reference of what IS possible with a totally rigorous approach.” I had not been the hugest fan of Shuttleworth for awhile for various reasons and tried, unsuccessfully I might add, to find another distro that suited me better. But between his flat-out “we will not even entertain a patent deal with Microsoft” and his seemingly increasing commitment to software freedom, rather than mere “open source” software, which is often not freely redistributable or modifiable, I am once more a fan. Keep up the good work, Mark!
  4. Open Up To Open Formats
    Robert Strohmeyer of MaximumPC has written an engaging article about the need for all of us, not just GNU/Linux users, to move to free and open formats rather than sticking with the old “standards” such as MP3 and DOC, both owned by corporations. Strohmeyer doesn’t spend a lot of time discussing the benefits of open music formats such as OGG, but he touches on the important bits, such as why DRM is a heinous affront to the rights of consumers. He mostly covers the issues with DOC, OpenXML (MS’s “open” format) and ODF (OpenDocument Format, used by OpenOffice.org).

    If someone’s been using Microsoft Word for a decade, and all of their old files are in the DOC format, they’ll most likely feel (whether it’s reasonable or not) that they should continue to buy upgrades to Word in perpetuity, out of an ill-founded concern for backward compatibility. The reality, however, is that proprietary standards create greater compatibility problems than open ones, because they are less subject to approval and oversight, and the changes they undergo tend to serve the interests of the vendor rather than the end user.

    All in all, not a bad read at all. And it’s very heartening seeing articles that are pro-freedom in a magazine like MaximumPC, which is geared toward hardware geeks who are, for the most part, running Windows. Give it a go, it’s short enough.

  5. Apple Purchases CUPS
    Apple Computers has purchased the CUPS printing system from developer Michael R. Sweet. While Apple first licensed CUPS for use on OS X in 2002, it has now purchased the source code and hired Sweet. While Sweet did say, “CUPS will still be released under the existing GPL2/LGPL2 licensing terms, and I will continue to develop and support CUPS at Apple,” I have had a steadily declining respect for Apple and the way it views software and consumer freedom. Maybe they’ll charge us an extra $0.30 per page we print like they charge for DRM-free songs on iTunes.