We explain every GNU/Linux command by examples in this blog!

I have too used to alarm clock, to wake me up every early morning. I set my alarm on my cellphone every night before I going to sleep. But recently, a simple stupid idea of creating an alarm clock in Linux comes to my mind.

I usually turns on my laptop overnight for some downloads, system updates. It is a basic requirement for a linux alarm clock. This example is a bit creepy, i know. But somehow it works.

First you need to calculate what time you wanna wake up? Let say if you wanna wake up after 5 hour and 30 minutes. You need to calculate the time in seconds using bc and parse the result to sleep, and later play a song to wakes you up after the sleep:

sleep `echo "60*60*5+60*30" | bc`; xmms -p

You can preloaded with any song and set your preferred volume.

The better and easy way should be using at or crontab. I have tried but it doesn’t seems to be working.