Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jul 092012
 

How to show current routing table

Answer:

To show the current system's routing table, you can try:

# sudo netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         102.147.87.1    0.0.0.0         UG        0 0          0 eth0
0.0.0.0         102.147.45.1    0.0.0.0         UG        0 0          0 eth0
102.147.45.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
102.147.87.0    0.0.0.0         255.255.255.0   U         0 0          0 eth0
Jul 052012
 

How to check if a RSA key file is valid

Answer:

If you have a RSA key file "test.pem" and want to know if it is a valid RSA key, you can perform a quick check

# openssl rsa -in test.pem -check
unable to load Private Key
21315:error:0906D064:PEM routines:PEM_read_bio:bad base64 decode:/SourceCache/OpenSSL098/OpenSSL098-44/src/crypto/pem/pem_lib.c:763:

If it is valid, you will find

# openssl rsa -in test.pem -check
RSA key ok
Jun 212012
 

Network sniffing with tcpflow

Answer:

Wireshark is the De facto standard in network sniffing, but most of the time you might just want to analyse the content passing through your web browser or web server, then it is easy with tcpflow

For example, to show your communication with google.com to console, you can use

sudo tcpflow -c -i en0 src or dst host www.google.com

Jun 012012
 

How to add a locale to Ubuntu server

Answer:

Ubuntu server only come with very few installed locales by default, e.g.

# locale -a
C
en_AG
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_NG
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX

To add more, e.g. zh_TW, you can type

# sudo locale-gen zh_TW

Then you can verify using the command locale -a again.