Tuesday, June 28, 2011

How to set alarm for console task

ASCII table has some nonprintable characters. One of them is 07 - Bell. It is a device control code originally sent to ring a small electromechanical bell on printers and teletypewriters to alert operators at the other end of the line, often of an incoming message. In unix you can input this character by pressing type it with Ctrl + V and then Ctrl + G which will be showed as ^G.

To set alarm for end of a task just put echo ^G after the command, for example try the following line in your terminal:
sleep 2; echo ^G
Similar technique works with the cat command.