Linux networking - edit /etc/network/interfaces for auto IP assingment aka DHCP

Commonly, changing network interface IP, subnet mask or DNS used to be on GUI (Graphical User Interface). But they will be times it needs to be done on CLI (Command Line Interface). e.g. the windows manager fail to start, window manager does not provide a GUI to change it, it is a server and no GUI allowed to free up more resources or Just For Fun.

The instructions below attempt to configure eth0 for auto IP assignment from a DHCP (Dynamic Host Configuration Protocol) server. It is tested on Ubuntu and will most likely do fine on debian based distribution  :


telnet - using telnet to test email server or send email (smtp pop 25) using telnet

telnet is a Swiss army knife for troubleshooting layer 7 application problem, especially useful on smtp & pop3 protocol.

Scenario 1 :
to test is our domain is being block by recipient domain, using telnet on our email server to send email on recipient email server.

Scenario 2 :
a quick test on error occurs sending email, using email client, such as thunderbird, apple mail, opera mail & others, using telnet.

telnet - using telnet to test email server or read email (pop port 110) using telnet

telnet has a lot of weakness compare to ssh. Most notably would be it transmits in plain text across the network, which everyone can look at it as long as one can tap into the line.  Still, it is very much useful in trouble shooting application layer problems, e.g. http, smtp, pop, ftp, irc & others.

This post attempt to demonstrate how to use telnet to trouble shoot pop3 protocol problems. Or even better, use telnet to read email on port 110.

Scenario 1 :
Often, when email client such as thunderbird, apple mail, opera mail & others, fails for some reason and its error message indicate that error occurs during communication with the server. But calling the server hosting administrator and they claim that the server is working fine.

Scenario 2:
The machine that we used does not belongs to us. Setting up an email account on it would certainly post security issue to our email account. But then, we just wanna find out what email messages have inside our mailbox. Probably, just wanna read a few lines of the mail message.


sed - search & replace with variables within bash

sed is extremely helpful in search & replace text, in file & variables. Often we need to construct a list of strings together with variables. But the normal usage of sed :
sed -e 's/text-to-search/string-to-replace-$variable-name/g'

will only replace the variable $variable-name literally rather then the pre-define value. After meddling with a few more stuff, the problem lies on ...

Ubuntu or Debian linux - utilities to monitor fan, temperature, speed

Another reason to use open source software. If you have just got yourself a Dell laptop and want to monitor the system fan, temperature, processor speed & other stuff, you're in luck. The open source community have come out with a piece of excellent utility to do the job. Better, the utility is able to control the fan speed. Means, you can set it to spin maximum or even off it. Here's how to do it :

Fluxbox - assign custom buttons for various program / operation in fluxbox

After some brief hiccups on fluxbox customization, some of you might be asking how to bind those volume keys (or other keys of that matter) into fluxbox. Wait no more, here it is :

Fluxbox - mouse left click not working after ~/.fluxbox/keys modified

Fluxbox is a extremely lightweight window manager that not only require little resource (compare to the resouce monsters KDE & GNOME), it also allow one to customize almost every aspect of it. It also allow changes on skin to reflect a much more customized desktop interface. Due to its nature, customization on it is quite straight forward. All the config files are stored at ~/.fluxbox/ directory. Fluxbox also have its own wiki which list every aspect of its feature customizable.

After editing the config files at ~/.fluxbox/, one just need to right click on the desktop (any empty space) and click on "Restart". It will re-launch the desktop and the changes are present. But on fluxbox version 1.0.0, after editing the keys config files at ~/.fluxbox/keys, the left click of the mouse stop working.

regex - pattern matching with numbers in sequence

Arghhh... Disk space is full. First thing to do? Of cause, is to free some disk space first. Next question, what to delete? Log files are the first on the list. But log files are normally named after running number in sequence. To delete them, it has to be either a "one by one" command"s" or in script. Oops, there is another way. Look forward :


Linux - system & various devices status information on desktop

System Admins like to monitor stuff. CUP, memory, network interface card, hard disk & etc. It would be better if the skin can be change. Of cause, since it is going to on it on the desktop most of the time, it should be light in resources. Plug in support is a must, to extend the monitoring functions & area. gkrellm is the answer.


vi or vim - Why the delete key, navigation keys (up, down, left, right), syntax color & a few more other are not working/missing ???

Ever wonder why vi behave weirdly after a new installation of Linux or BSD? Delete key turns the current character into capital, navigation keys adds a newline with random characters, Home & End key does nearly the same, syntax color no longer works (which is eye soring if reading along with a bunch of comments) & other frustration.

That's suppose to be.

Because the default vi (literally) that comes with the default installation is the stripped down version of vim. The usual vim that comes with the more comforting features are still around, just that it needs to be tweak. Or most, install.

rsync - transfer rate limit aka "slow it down"

rsync is a great tool. For archiving, copying & of cause syncing. It's able to copy to destination and maintain the same permission (-a), be verbose (-v), show the progress bar (--progress), log the process (--log-file=logfilename) & etc. But there are times when rsync is running on a slow connection, over a big set of files. You're in luck, rsync support rate limit. Although it is rate limiting the I/O bandwidth, it is useful enough for us to pump the data onto the pipe with the speed we want.


Grub - password protect boot entries in Grub using md5

Securing machines, from physical access compromise. Backups, user logins, encryption, BIOS (some mistook it as CMOS) access password protected, how about boot loader? It can potentially boot into single user mode and reset what ever password. Gotcha?

If grub is used, you're in luck. Grub is capable to apply password to every boot or every entry in it.


DNS - how to add, create, edit and verify BIND DNS SRV resource record (RR) type

ISC BIND DNS SRV resource record type is rarely needed on a open source world, at least not as frequent as A, NS, MX, CNAME PTR and TXT resource record. After creating it in BIND DNS as the sample format below :

Ubuntu - how to check Ubuntu version

After a distribution update in Ubuntu, wanna check out the version?

Run the below command :

Ubuntu - how to set the max / correct resolution for Nvidia cards and LCD monitor

After installing a new display Nvidia card on Ubuntu linux, it did not detect the correct resolution available on the monitor. Rather, it uses the wrongly (normally lower resolution) detected resolution, which resulted poor display. After checking out /var/log/Xorg.0.log, it reported correct max resolution detected both on the Nvidia display card & monitor. Below is the resolution :


OSX - How to search/install/update Macports packages

Having to use a mac has been rewarding for the functionality of OS X, state of the art hardware, reasonable price, and most of all (to us open source monkeys), free software. Free software on mac have always been a problem if the developer did not make it available on mac. Even though the source of the software are made available, it could still be a hassle to compile and debug. Thanks to MacPorts, all of this can be done in just a few words of execution.

The installation of MacPorts can be found here. Below are the common usage of MacPorts :


sed - \t as tab does not work

Problem :
taken from the SED $HOME :

"USE OF '\t' IN SED SCRIPTS: For clarity in documentation, we have used
the expression '\t' to indicate a tab character (0x09) in the scripts.
However, most versions of sed do not recognize the '\t' abbreviation,
so when typing these scripts from the command line, you should press
the TAB key instead. '\t' is supported as a regular expression
metacharacter in awk, perl, and HHsed, sedmod, and GNU sed v3.02.80."


RSS feed on wordpress

Blogging have been a important part of internet. Blogging have never been so easy with WordPress. Blogging has not only been personal diary but rather, it make information sharing easier for everyone. We all have not only one blog we are reading daily, but we have a dozen or more to visit. RSS makes our life easier by just extract the summary of the site and deliver it to our RSS readers (firefox have it built into bookmark)!

Problem :
Want to read WordPress blog on a browser or RSS reader.

vim - cut / copy paste with indent intact nicely

System administration in Linux / BSD can never do without a text editor, and vim is definitely de-factor editor. vim is not only an text editor, it can be also a IDE (integrated development environment) and it is extremely light in resource. Just to mention a few of its features, syntax highlighting, auto indent, search & replace, copy/cut & paste & others. vim comes with all versions of linux & BSD, check your flavors documentation.

Problem :
copy / cut text from other apps (e.g. gedit, openoffice, kedit, abiword, textmate, notepad, textedit & other text editor) to vim often jumble up the space.