Skip to main content

cmus - Get file size of currently playing song

This is a simple Bash script to show the file size of the song being currently played by cmus.

#!/usr/bin/env bash

# show size and filename
size=$(cmus-remote -Q | awk '/file/ {print $2}' | xargs du -h | awk '{print $1}')
name=$(cmus-remote -Q | awk '/file/ {print $2}' | xargs basename)

# zenity dialog
zenity --title=cmus-filesize --timeout=5 --info --text="[${size}] - ${name}"

Note: The script requires Zenity.

Save this file to a location of your choice, and then type the following at cmus' commandline:

bind -f common F2 shell /home/notfoss/bin/cmus-filesize

Change F2 with a key of your choice, and replace the path and filename accordingly.

Now, whenever you press the assigned key from within cmus, you will get something like:

cmus file size

Interesting Links - September 2013

World of FOSS:

Cool Stuff:

  • Use GNU Stow to manage your dotfiles. You can find a couple of different ways to achieve the same here.

  • Hermit is a new font oriented towards programmers. Don't like it? You can find some of the best fonts available for programming on this page.

Continue Reading...

New Domain

Just a quick heads up for all of the 5 people that visit my site (maybe more :P), I have migrated the site from to

Please update your bookmarks and RSS feed urls.

The previous domain will redirect to the new one for a while, so in a way nothing will change. But in any case, take action while the news is fresh, lest you forget ;)

Interesting Links - August 2013

Linux / FOSS:

  • Elementary OS "Luna" was released earlier this month. Elementary OS is an aesthetically pleasing derivative of Ubuntu, with a focus on a uniform look and feel. Seems Linux Mint has got competition ;)

  • Debian celebrated its 20th birthday.

  • An excellent interview with Ubuntu Founder — Mark Shuttleworth, which offers an insight into the motivation behind funding Ubuntu, and his vision for the future.

  • Vim 7.4 was released. It is the first stable version of Vim to come out in 3 years, after Vim 7.3 was released in 2010.


  • Lavabit — a popular email service among privacy advocates — was shut down by its founder Ladar Levison, in retaliation to unjust interferance by the USA government.

  • In case you haven't heard about this already — those who don't have a Facebook profile, might still have one!! This article explains, how Facebook creates shadow profiles of the people who don't have a Facebook account. The *best* part is that you cannot do anything about it...

Continue Reading...

Tips and Tricks - 1

So, I decided to start a new post type, namely Tips and Tricks.

These will constitute random — as in not pertaining to a particular topic — tips. But, are short enough, that they do not warrant full individual posts. Mainly the things which I have recently discovered, or had long forgotten :P. But also, the things which I regularly use and think can be useful for others.

So, let's start with the first post of this kind.

*Drum Roll*

1. Bash

1.1 Overriding aliases temporarily

Most shell users are probably familiar of aliases. Interacting with a shell becomes extremely convenient using aliases.

Now, sometimes we name our aliases after the actual commands themselves. For example, I have an alias rm='rm -iv'.

But, what if I wanted to run the original command?

One way to do that is by specifying the full path to the binary. But, there is an easier way to do the same. Simply prepend a slash before the alias, and the unaliased command will run instead. Example:

$ \rm

Continue Reading...

Git - Compare and edit different revisions of a file using Vim

Say, you want to open a copy of a file (under a git repository) and use it as a reference while making changes to the original file. This can be done easily using a number of methods.

One such method is (after you are inside the git repository):

(assuming the file is README.rst)
$ cat README.rst | vim -

You'll probably need to set the filetype, as Vim does not detect the filetype through stdin for many formats. Then do :split README.rst inside Vim, and you have a reference as well as an editable copy of the same file.

But, what if you had modified README.rst without committing the changes?

In such a case, you can use git difftool, which will open the committed and uncommitted files in the diff tool of your choice. I prefer vimdiff.

Continue Reading...

Interesting Links - July 2013

Many interesting things (some saddening) took place in July. Some of those are mentioned in the following sections.

Linux / FOSS:

  • The official Ubuntu Forums were hacked. They did the right thing by immediately acknowledging the hack. But the overall handling of the situation has left a sour taste in my mouth. Reasons:

    • First they took several days to send notifications out to the users by email.

    • After finally restoring the forums after about a week, they are now requiring everyone to register with Ubuntu One and that account will be tied with the forums account.

  • Feel that the BusyBox is lacking in some places? Toybox is a BSD-licensed alternative for that.

  • Slackware is now 20 years old!.

  • The H — often regarded as one of the few decent open source related publications — has gone the way of the Dodo. They cited lack of profit as the reason. I had read articles published on The H a few times in the past, but only recently had I started visiting it regularly. Too bad, that didn't last for long.

Continue Reading...