Sunday, January 10, 2010

[Game] SuperTux and Pingus

SuperTux and Pingus

If you are my friend, you should know that I seldom play computer games since I think it is quite meaningless and time-consuming. I, however, still play some mini computer games, such as Mine, Tetris, etc. In Linux, I found two games which are free and quite interesting to play. They don't waste you lots of time, I finish them within about two days. You need wisdom and skills to finish the games. Hope you enjoy them!

If you would get more details about them, please visit following links:



Screen shot:


SuperTux







Pingus







Saturday, January 9, 2010

[HOW TO] turn on NumLock when login Linux

Do you think it is convenient to turn on NumLock when you logon the system?

I used MS Windows for a long time and switched to Linux for about two years. In MS Windows, Numlock is already turned on when I logon. While in Linux, Numlock by default is off and I need to press numlock key before using key pad(but I always forget :-))

I searched this problem in Google and found a good program called NumLockX. You can install it through yum or apt-get

To install NumLockX using yum

yum install numlockx


To install NumLockX using apt-get

sudo apt-get install numlockx

Wednesday, January 6, 2010

[HOW TO] get MAC Address and IP in shell

Do you wanted to get the MAC or IP address of your computer in a Linux shell script?

Some people including me feel it is troublesome to get the real ip if using router.The following commands can help you to get them easily.

(These commands only get information from eth0 interface. If you have many network interfaces, you need to modify the command by changing "eth0" to your favour(e.g. lo))

To get internal IP address:

ifconfig eth0 | grep 'inet '  | sed -n '1p' | tr -s ' ' | cut -d ' ' -f3 | cut -d ':' -f2


To get MAC address

ifconfig | grep 'eth0' | tr -s ' ' | cut -d ' ' -f5 


To get external IP address:

wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1 | sed -e 's/^ *//' -e 's/ *$//'


If you think these commands are good and want to be your shell command, just copy following commands to "~/.bashrc" or "~/.bash_profile"

alias showip="ifconfig | grep 'inet ' | sed -n '1p' | tr -s ' ' | cut -d ' ' -f3 | cut -d ':' -f2"
alias showmac="ifconfig | grep 'eth0' | tr -s ' ' | cut -d ' ' -f5 "
alias showrealip="wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f 2 | cut -d\< -f 1 | sed -e 's/^ *//' -e 's/ *$//'"