Print your X idle time

Xprintidle is a utility that queries the X server for the user’s idle time and prints it to stdout (in milliseconds). You could use it to check if anyone was sitting on your computer while you were away 😛 or even write scripts to perfom simple tasks like limiting your total idle time or send mails and notices.

# apt-get install xprintidle

Example:

while [ 1 ];
do
if [ `xprintidle` -gt 120000 ];
then
notify-send "You have been idle for 2 mins"
   break
fi
sleep 1
done

This script will send a notification when idle is more than 2mins and stop.

Be creative 😀

Sending commands to Xchat from the command line

A nice way to send commands to xchat from the command line is by using D-Bus. D-Bus is a system for software applications to communicate with one another. A nice command tool for that job is dbus-send and comes with the “dbus” package in debian.

Continue reading Sending commands to Xchat from the command line

Finding the installation date for a linux machine.

A good way to find the installation date of a linux machine is by using the passwd command with the -S option. This option displays account status information. The status information consists of 7 fields according to “man passwd”. The third field gives the date of the last password change. So, by finding the date of the users who never changed their password we can easily assume the installation date.
These users can be system users like, sys, bin, daemon etc.
example:

# passwd -S sys
11/11/2009 0 99999 7 -1
# passwd -S daemon
daemon L 11/11/2009 0 99999 7 -1
# passwd -S bin
bin L 11/11/2009 0 99999 7 -1