Posts Tagged ‘Console Junkie’

Console Junkie: Conky Makes Your Desktop Awesome!

July 4, 2009

What is conky?

Conky is a light-weight system monitor, which can display any information you want on the desktop. You can get it here, or you can simply install it with:

sudo apt-get install conky

If you want my conky setup though, you should compile it from source. I’ve explained why further in the post, so read through the whole thing before you go setting up your own conky. Here’s what my desktop looks like:


As you can see, I show music stats on the right hand side. I use mpd for music. Now, conky has in-built mpd support, which means using these conky variables for mpd make it faster and lighter on resources. However, these variables are disabled by default in the version available in Ubuntu repos. You won’t be able to use them if you do a sudo apt-get install conky. Hence the compile-from-source bit. If you are not using mpd for music, you might as well do a sudo apt-get install. If you are compiling from source, this is an excellent guide.

So that’s done. Next you will need to download my conky config files and other scripts required for the setup. You can download them from here. Extract them and rename the folder as scripts. I keep all my scripts at /home/vedang/Source/scripts/, and this path is hardcoded into the scripts everywhere. Please search for the string and change it appropriately.


Console Junkie: Installing MPD and grooving away to glory!

June 22, 2009

What is MPD?

Quoting from this article:

Music Player Daemon (MPD) allows remote access for playing music (MP3, Ogg Vorbis, FLAC, AAC, Mod, and wave files) and managing playlists. MPD is designed for integrating a computer into a stereo system that provides control for music playback over a local network. It is also makes a great desktop music player, especially if you are a console junkie, like frontend options, or restart X often.

In this post, I’ll be explaining how to get MPD up and running on Ubuntu (9.04). If you are working on some other platform, you can simply compile from source wherever applicable. Also, this post is mainly about using mpd as a desktop music player. The configuration part of it is common across distributions. So lets get started!

First, we need to install mpd.

sudo apt-get install mpd

Let us now configure it and get it up and running. You can either directly configure mpd for system-wide usage (/etc/mpd.conf) or you can configure it on a per user basis (~/.mpdconf).

sudo cp /etc/mpd.conf ~/.mpdconf

Before we edit our .mpdconf file, we need to create a few directories.

mkdir -p ~/.mpd/playlists

Emacs Tip of the Day # Are you a fan of Tab Completion? #

October 16, 2008

Tab Completion is a great, great feature. It saves me a lot of time and effort, in bash as well as in the Emacs minibuffer.
I don’t know if you are aware of this, but Emacs also comes with a built-in feature called dabbrev-expand (M-/ in the minibuffer). Here is what it does. If you type out the first few letters of your word and hit the key-combo, it auto-completes the word after searching the current buffer and the other open buffers for completion. You can cycle through all possible completions by repeatedly reinvoking the function. This is very, very cool. The only problem is that M-/ is not conducive to speed.
So can we do something super cool like re-bind the function to the TAB key? Without destroying other tab related functions like indentation? Turns out we can!

(global-set-key [(tab)] ‘smart-tab)
(defun smart-tab ()
“This smart tab is minibuffer compliant: it acts as usual in
the minibuffer. Else, if mark is active, indents region. Else if
point is at the end of a symbol, expands it. Else indents the
current line.”
(if (minibufferp)
(unless (minibuffer-complete)
(dabbrev-expand nil))
(if mark-active
(indent-region (region-beginning)
(if (looking-at “\\_>”)
(dabbrev-expand nil)

Add this to your .emacs file, and start using TAB in everything you type. You will find that your typing speed triples!


Console Junkie: HowTo use rtorrent, Part II

October 5, 2007


Q: Ok, so now I’ve installed rtorrent. What next?

A: Let’s get started. Open the console and type

Q: Umm…

A: Now you want to know how to add a torrent. Hit Return. You can use tab completion to navigate to the directory with the torrent file. Double-tab will display completion options. Select torrent file. Hit return.

Q: The torrent file is marked inactive!

A: You need to tell it to start. Highlight the torrent file using arrow keys, and hit the Hotkey ^s (^ means Ctrl key). While it is inactive, you can change the download directory by using ^O. This doesn’t work once the torrent is activated. You can also use the Backspace key instead of Return to add torrents. The difference is that this will immediately activate the torrent. To stop an ongoing download, type ^D. Type this again to delete the stopped torrent.

Q: Ok! Got it working! Is this it?

A: Well, these are the basics. Now, let’s see a few other things. You may want to cap your upload/download speeds. This can be done using the keys a/s/d, A/S/D, z/x/c, Z/X/C.

Q: And how do I see info about the files?

A: You can navigate using the arrow keys. Highlight the torrent using Up/Down, Left will give expanded view and Right will go back to main view. You will find that the keys 1-8 offer various different views of the downloads. You can change the priorities of the torrents using the keys +/-. You can even change the priorities of individual files, by selecting them in the file view, and hitting space. If you select priority ‘off’ file will not be downloaded.

Q: Woot!

A: Now, lets turn this ordinary bumbling application into a super-app. You may notice that on starting rtorrent, it throws a warning saying .rtorrent.rc not found. This is the configuration file for rtorrent, which is found at
Copy this file into your home directory, affix the . in the name, and open it in a text editor.

Q: Wow! Is this what I think it is?

A: Yes. A simple glance at the file will show you what I mean. Check this out:
# Global upload and download rate in KiB. “0” for unlimited.
#download_rate = 0
#upload_rate = 0

# Default directory to save the downloaded torrents.
#directory = ~/

You can set the global throttle rate, and the default download directory. Now see this:
# Watch a directory for new torrents, and stop those that have been
# deleted.
#schedule = watch_directory,5,5,load_start=~/*.torrent
#schedule = untied_directory,5,5,stop_untied=

rtorrent will watch the watch_directory, and automatically start any torrent copied into it. If you delete the torrent file from this directory, it will automatically stop the download.
# Close torrents when diskspace is low.
#schedule = low_diskspace,5,60,close_low_diskspace=100M

# Stop torrents when reaching upload ratio in percent,
# when also reaching total upload in bytes, or when
# reaching final upload ratio in percent.
# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0
#schedule = ratio,60,60,stop_on_ratio=200,200M,2000

This is pretty much self-explanatory. Go through the rest of the file. Convert your rtorrent into a beast.

Q: All of this is truly great! But I’m sure this is available in Azureus. So why rtorrent?

A: All I can say is:
1)negligibly light footprint
2)about 2MB space cost
3)no Java/Gnome/Other Window Managers/X dependencies.

Q: Yes, I think I’ll give it a try!

HowTo: use rtorrent like a pro

Console Junkie: HowTo use rtorrent, Part I

October 5, 2007


A couple of days back, I mentioned that my absolute favorite torrent client is Deluge, because it is less of a resource-hog than Azureus. However, recently I’ve become a console junkie, giving up the pleasures of GUI for the far more interesting CLI.

rtorrent is a ncurses based torrent client, that is reputed to be the lightest and fastest client in town. Here is the output of the top command on my comp:

vedang@ninjakombda:~$ top | grep rtorrent
8965 vedang 0 3.3 0:54.82 rtorrent
8965 vedang 0 3.3 0:54.83 rtorrent
8965 vedang 0 3.3 0:54.84 rtorrent
8965 vedang 0 3.3 0:54.85 rtorrent
8965 vedang 0 3.2 0:54.86 rtorrent
8965 vedang 0 3.2 0:54.87 rtorrent
8965 vedang 1 3.2 0:54.89 rtorrent
8965 vedang 0 3.2 0:54.90 rtorrent
8965 vedang 0 3.2 0:54.91 rtorrent

Blogger killed my top output, so I’ve had to format it a bit. My apologies. I don’t know much HTML.

As you can see, it uses less than 1% of my CPU, and only 3.3% of memory. Not to mention that it doesn’t have a hundred dependencies. Also, it is really, really powerful!

So how do we begin installing this? Simple. Download the stable release of libtorrent and rtorrent from (at the time of writing this is libtorrent-0.11.7 and rtorrent-0.7.7) and extract the contents into your favorite directory (I’ve done this in my home directory). Now, run the following commands:

cd libtorrent-0.11.7
sudo make install
cd ..
cd rtorrent-0.7.7
sudo make install

Done! Next post we’ll see how to actually use rtorrent, and make it a torrent-handling beast.