Tag Archives: linux

Linux notifications for the Kynetx KRL command-line tool

This is a response to Mike Grace’s excellent post, Growl Notifications for Kynetx KRL Command Line Tool. The idea is entirely his; I’ve just implemented a solution for Linux. I recommend you go read his post so you know what this is all about.

Since Linux uses libnotify instead of Growl, it’s fairly simple to implement as similar solution to Mike’s on a Linux system.

You’ll need the libnotify-bin package installed. You can do that in the normal manner.

First, add the following to your ~/.bashrc file:

krl() {
  if [[ $1 == "commit" ]]; then
    command krl $@ | tee status.txt
    notify-send -i ~/.kynetx-x.png “KRL” “`cat status.txt`”
    rm status.txt
  else
    command krl $@
  fi;
}

This is basically creating a function that will run whenever you issue the “krl commit” command. It pipes the output of the KRL gem to a file and then uses the text of that file in the notification.

You can download the Kynetx “X” image to your home directory if you like with the following command:

curl https://kynetx-apps.s3.amazonaws.com/krl-commit-growl-notify/kynetx-x.png > ~/.kynetx-x.png

That’s it! Have fun!

Setting up a passwordless login over SSH

Here’s how you can set up a public key to allow you to login to a remote server over SSH without a password. (I draw mainly on the instructions here.)

First, open a terminal on your machine. We’ll call it mybox. We’re going to create a public key.

[me@mybox ~]$ ssh-keygen -t rsa

This will ask you first where you want to save the public key you’re creating. (The default location ~/.ssh/id_rsa is fine.) It will then ask you for a passphrase. You can just press enter twice at those prompts to skip the passphrase (I always have).

Now make sure there is a .ssh directory in the home folder on the server where you want to log in (we’ll call it myserver):

[me@mybox ~]$ ssh me@myserver mkdir -p .ssh

Next we’ll append the public key from mybox to the authorized_keys list on myserver:

[me@mybox ~]$ cat .ssh/id_rsa.pub | ssh me@myserver ‘cat >> .ssh/authorized_keys’
(Note that those are single quotes, not backquotes.)

That’s it. You can test it with any command that uses an ssh tunnel (ssh or even svn or git, for example). Also note that you can use this same public key to set up passwordless login on any machine you like.

Now another handy thing is adding preconfigured setups to your ssh config file. It’s located in ~/.ssh/config. Here’s an example setup:

host server
    Hostname myserver
    User me

(See this reference for explanation on all the possible parameters you can use.)

Now you can type ssh server on the command line and get logged right in–no need to specify your username or enter a password.

Now mind you, this could potentially be a dangerous setup. Only use this on a well-secured computer where you are the only person with access to your terminal. Any hacker that gets in to your machine can now log in as you to myserver without having to know your username or password. Convenience comes at a price.

One window manager to rule them all…?

Every Linux hacker has his favorite window manager (or maybe even just the console!). What is mine? Fluxbox.

I’ve used GNOME, Xfce, fluxbox, and xmonad, and I like fluxbox the best. Here is my reasoning:

  1. Speed It’s fast. Really fast. Not as fast as xmonad, but it retains enough of the elements of the more mainstream GUI WMs that you don’t feel quite so intimidated by it.
  2. Customizability Fluxbox lets you customize your theme, menu, hotkeys, and a few other things, and it gives you more control over those things than do GNOME or Xfce. Given, it’s all done from text files (unless you use fluxconf), so it takes some time to learn. But it’s quite powerful.
  3. Compatability All my normal software still runs fine under fluxbox. This might be just because I have GNOME installed, too, I’m not sure. But it works.
  4. Keyboard use It’s pretty easy to use virtually all the fluxbox-specific features from the keyboard (although it sometimes requires tweaking, as with the Alt+Tab behavior). And the terminal always occupies a front row seat on my desktop.
  5. Lean, green, computing machine Fluxbox just has the stuff you need, and no heavyweight GUIs to manage it. Of couse, that makes it harder for the beginning user, but both the power user and the novice can be productive with it.

I started using Linux under GNOME, and I still like it. Especially on Ubuntu (the distro I run), it makes it easy to do everything from text editing to web browsing to system administration from the GUI. And that’s good. But once I became more accustomed to the terminal and the command-oriented way of doing things, fluxbox was a great step forward.

All the same, I still don’t believe there is “one window manager to rule them all.” What are your thoughts on the plethora of window managers? Should it be a battle for the fittest, is the community headed in the right direction by providing so many choices?

xmonad: the mouseless window manager

The other day I discovered (through link surfing) a window manager called xmonad. It is an extremely small (the compiled executable is 1.2M), lightning fast, sleek window manager for Linux designed to make the most of screen real estate and maximize your productivity using X. It can operate entirely without the mouse.

xmonad window managerxmonad works by opening windows in tiles, which are rearranged as you open more windows. The primary window is on the left or top half of the screen (depending on which mode you’re in) and the other windows stack in the other half of the screen. You can switch between windows using Mod+J and Mod+K (“Mod” is the Alt key on my machine), and you can swap windows to and from the primary position. Naturally, there are multitudinous ways to resize, move, and reorder the windows within the different panes. It also includes support for multiple workspaces (as do most WMs) and even multiple monitors if you have them.

I’ve been playing with xmonad for a little while now and I quite enjoy it. It allows me to work easily from the command line but still run my X apps without too much hassle. I’ve found, however, that with programs like Firefox which pop up smaller windows on occasion (e.g., file and settings dialogs), it’s best to run in full-screen mode. When running in the normal tiling mode, the popups sometimes take on strange proportions as they are squeezed into the existing layout. Using full-screen mode usually gives them their natural dimensions.

No title bars, no icons, no nonsense. This window manager is very simple, clean, and fast. There’s a bit of a learning curve with all the keyboard navigation, but for any Linux hacker who knows vim, it shouldn’t be too hard to pick up.

Mostly for my own benefit, but also for any fellow Linux geeks, I’ve posted the process I went through to install xmonad:

  1. First make sure you look at the overview, which includes everything you need to get started. It describes how to get the Haskell compiler and the required packages, including mtl, X11, and X11-extras (those were the three I had to get myself).
  2. Once I had installed all the required packages, I installed dzen and dmenu (which involved compiling them from source with make).
  3. At this point, you want to edit xmonad’s Config.hs script to put a space at the top for dzen to run as the status bar. This file is in the source directory for xmonad. Open it and find the line that says “defaultGaps = [(0,0,0,0)]” and replace it with “defaultGaps = [(18,0,0,0)]“.
  4. Now compile xmonad with the runhaskell command, as described in the documentation. (Make sure to keep the source around, since any reconfiguration you do requires recompilation.)
  5. I found it easiest to use the .xsession script to launch xmonad from the gdm, rather than using a .desktop file in /usr/share/xsessions, since it’s easier to specify startup programs and the like. Here is my .xsession script:

    unclutter -idle 1 &
    while true ; do
    bt=`acpi -b | sed -n ‘s/.*, ([0-9]*%).*$/1/;1p’ | xargs printf ‘Battery: %sn’`
    tm=`date +”%H:%M %a %b %d”`
    printf “%s | %sn” “$bt” “$tm”
    sleep 60
    done | dzen2 -ta r -fg ‘#ffffff’ -bg ‘#808080′ &
    xterm &
    xmonad

    • The unclutter command instructs X to hide the mouse once it’s been idle for one second. (There is a package for unclutter in Ubuntu.)
    • The next six lines describe the text I want dzen to display in the status bar. The “date” part displays the date in the form “21:59 Fri Jul 13″. The other part extracts the battery percentage from acpi and formats it (which is important because I’m on a laptop).
    • The printf command concatenates those two pieces of information.
    • The sleep command tells dzen to wait 60 seconds between each update.
    • The last line actually passes that loop to dzen and sets some options.
    • The second-to-last line starts a terminal so I can start using it as soon as I log in. (Otherwise it just presents a blank screen and the status bar.)
    • Finally, the xmonad command starts the window manager itself.
  6. Now it’s play time! Experiment with the layout features and keyboard shortcuts and customize to your heart’s content! And long live the terminal! ;)

So there we go. Yet another nifty window manager for Linux.

UPDATE: Tassilo posted some more technical information about xmonad on his blog. Take a look if you’re interested in diving in yourself. Also, thanks the the guys at xmonad for their link.

Web nostalgia, Microsoft's Linux deals, and a few gadgets

Happy Friday the 13th! Here are some links for today:

  • This Is What The Web Looked Like In 1994 A nostalgic look at the web 13 years ago. Somewhat depressing, altogether quite laughable. Now you can use browser emulators from that period to view current websites. A good study for those designing websites intended to degrade nicely in non-standard browsers. ;) By the way, Geek with Laptop is a pretty slick blog; I just found it yesterday.
  • The New Linux Distro – Are the Linux companies who have made “patent deals” with Microsoft really just letting Microsoft make money off Linux? Who is really benefiting here, Linux companies, the Linux community, or Redmond? A good quote about the importance of the community:

    These companies forgot one thing…the power is with the consumer. The power is in the community. Ubuntu realizes that…they’ve embraced the community and look what’s happened! The community holds the power to make or break…the power of spoken word cannot be underestimated.

  • Mean Spirited Comments and Blogging – Good exposition on what to do when you run across nasty comments, as I did on Trolls.
  • Running a Windows Partition in VMware – For Linux hackers who would rather not leave their comfortable environment to use Windows (and yes, the need does arise at times, sadly), here are directions on how to mount an existing Windows partition and run it in a VMware virtual machine.
  • Call feature on Google Maps – Now Google will let you call any business number listed on Google Maps from your phone, without calling them directly. Google pays long-distance charges.EDIT: This has been discontinued.
  • Controlling Jobs in Linux – Great tutorial on job management from the Linux consoleEDIT: Site is no longer active

Microsoft patent infringements and Linux

The latest buzz in the Linux forums deals with Microsoft’s claims on patent infringements. Novell made a deal with Microsoft last year dealing with interoperability between Linux and Windows. Word has it that Red Hat is now following suit, despite previous resistance, and making plans to talk to Microsoft.The part that baffles me is how Microsoft is claiming that open-source software is infringing on its patent rights, even though it may be that Microsoft has violated some open-source patents.

Now it seems the Free Software Foundation has made a blunder with the new GPLv3. It makes me wonder if the open-source community will leave the FSF in the dust or if they will submit to the new terms. Linus Torvalds, at least, has said that they don’t anticipate moving the Linux kernel to the new GPL.

What a mess.

On the brighter side, Apple’s stock is skyrocketing since the iPhone came out last week.

JALVWA (Just another Linux vs. Windows article)

I just read an interesting article today about the linux vs. Microsoft battle. The author’s thesis is that the latest division among linux distributions and companies, those who are making deals with Microsoft and those who refuse to do so, just adds to the list of differences but won’t totally fracture the linux world. His last two paragraphs were the most interesting to me:

At the end of the day, Microsoft wants to sell you a unique, proprietary product. No matter where a business falls on the open-source/free-software spectrum, it wants to sell you support and the freedom to make your own IT way. You can argue endlessly about Ubuntu being better than Vista or Windows Server 2003 delivering a higher TCO than Red Hat Enterprise Linux 5, but here’s the part that Microsoft really, really hates and can no longer deny: Both approaches create workable software.So, here we are: Microsoft is making Linux partners. Microsoft is making patent claims. Microsoft is trying to stir up controversy. But, as my grandpa might have put it, “Microsoft is still bringing cards to a horseshoes tournament.” No matter how Microsoft tries to stack this deck, Microsoft is not going to win.

A friend and I had a discussion yesterday about why attempts to drive Ubuntu (or any other linux distribution) into the mainstream OS market will most likely fail. Simply stated, Microsoft has created a good product that works well enough. Normal people are used to it, and IT departments like it because it’s easier to support. My friend also said that a Microsoftie he knows told him linux is ill-prepared for the security challenges of the real world. I don’t know if I agree with that, but he may be correct.

I don’t like Windows any more than the next linux geek, but I do have to admit that they have a monopoly (call it what you will) on desktops and even servers. We’ll see who wins in the end: Microsoft, Microsoft + Novell, or open-source.

By the way, Java != Just Another Vague Acronym, but all the same…

Xfce desktop environment

screenshot2.pngI started using the Xfce desktop environment under Ubuntu the other day and have loved it so far. GNOME is a bit too heavyweight for me, so I’ve been using Fluxbox for a few months. It’s lightning fast and really slick, but there’s no eye candy whatsoever.

So the other day I decided to download Xfce and try it out. It looks quite similar to GNOME but runs a lot faster. It’s much easier to customize than fluxbox and it supports my keyboard metakeys much better. Plus the eye candy is great without taking too much toll on the speed. I really like the themes, too. (There are even some windows-esque ones.) And everything runs just as well or better under Xfce as it did under fluxbox.

Another cool feature is the ability to create multiple “sessions” or startup profiles. You can set Xfce to prompt you for which session you want when you log in. So I can create one for play, one for work, and one with nothing special.

So there you have some ramblings about the wonders of Xfce.

Ubuntu Studio

screenshot-1.pngI helped my friend install Ubuntu Studio on his laptop yesterday and today. It’s pretty cool, I must say. Being a huge linux fan, I’m really excited for him. Ubuntu Studio has a ton of open-source multimedia authoring and editing software. And a really sweet theme (pictured at right).

We ran into some issues while installing but were able to resolve them fairly easily. Here’s a summary and some tips for anyone that may be having the same problems:

  • He first installed 6.06 because that was the only CD version he had. Since it was a fresh install, he didn’t have any trouble upgrading to 6.10 and then to 7.04 (besides a slow connection).
  • Once the full 7.04 system was installed, we followed the instructions on The Ubustu Feed to install the Ubuntu Studio packages on top. We had to make sure the “universe” repository was selected, as we were getting “<package name> is not installable” messages.
  • His screen resolution was less than optimal (1024×768 on a widescreen laptop made for 1280×800). But he has an Intel graphics card, so we resolved it using the 915resolution package and these instructions.

rm -rf

Just a note to you UNIX users out there. rm -rf is a dangerous command. I’ve been warned from so many sources I don’t remember them all, but I still manage to use it somehow. Today I deleted a whole directory of image files on a project at work. (Luckily I had a backup from yesterday, so it was just fine.) But the point remains: Be careful using rm -rf!

I’ve made an alias in my .bashrc file that says rm='rm -i', just so it will make me confirm things in case I actually wasn’t paying attention. (Obviously using -f overrides that, which is convenient when deleting directories but very dangerous at the same time.)

Be careful with sudo, too…