Monday, August 31, 2009

Fixing Wired Network (eth0) Ethernet

While using Debian based systems(like Ubuntu), I often found that network manager just got into the way whenever I wanted to fix an internet connection. So, first thing to do is to kill the associated processes (kill -9) after you find the process ID by using ps. Or you can totally get rid of these packages (usually network-manager, network-manager-gnome in GNOME or knetworkmanager in KDE).

Then, edit /etc/network/interfaces file.

$ sudo vi /etc/network/interface

auto eth0

iface eth0 inet dhcp

again assuming that we want to have a DHCP based connection.

Then restart the network connection by issuing the following command:

$ sudo /etc/init.d/networking restart

Friday, August 14, 2009

Determining Bits of CPU and OS (32/64-bits)

In order to determine whether OS/CPU is 32-bit or 64-bit,
you can use this shell script.

echo -n "Running "

RES=`uname -a | grep 64`
if [ $? -eq 0 ]; then

echo -n "64-bit "
echo -n "32-bit "
echo -n "operating system on a "

RES=`cat /proc/cpuinfo | grep " lm "`
if [ $? -eq 0 ]; then

echo -n "64-bit "
echo -n "32-bit "
echo "machine"

Sample Run:

$ ./
Running 64-bit operating system on a 64-bit machine

Wednesday, August 5, 2009

Let Linux Speak Time and Day for You

I have written a single line command that tells time of the day:

$ espeak "Time is `/bin/date \"+%H
hours %M minutes %S seconds\"`"

You need not to type this command every time, just run the

following commands only one time:

$ echo "alias speak_time='espeak \"Time is \`/bin/date \"+%H hours %M minutes %S seconds\"\`\"'" >> ~/.bashrc

$ source ~/.bashrc

Now, you will be able to run speak_time any number of time at any time, and you will get exact time. :-)

$ speak_time

PS: Requirement of above command is "espeak"

$ sudo apt-get install espeak

For speaking day, just add following alias in your .bashrc file

alias speak_day='espeak "Today is `/bin/date \"+%A, %d %B 20%y\"`"'