Wednesday, March 29, 2006

Print system information under Linux

'uname' prints information about the machine and operating system it is run on.
% uname -a

Linux localhost.localdomain 2.4.20-8 #1 Thu Mar 13 17:18:24 EST 2003 i686 athlon i386 GNU/Linux

Use this command if you want to know any of the following information
kernel name
network node hostname
kernel release
kernel version
machine hardware name
processor type
hardware platform
operating system

If you are interested in knowing information about the kernel distribution then use `cat /etc/issue` The output of which will be something as below (on Red Hat ofcourse)
Red Hat Linux release 9 (Shrike)
Kernel \r on an \m

Thursday, March 09, 2006

Proxy Settings - Enviroment Variables

Proxy can be set up using environment variables automatically for all users by creating the following file,

/etc/profile.d/proxyenv.sh
http_proxy="192.168.36.204:8080"
https_proxy="192.168.36.204:8080"
ftp_proxy="192.168.36.204:8080"

export http_proxy, https_proxy, ftp_proxy

If you are using csh instead of bash then create the following file,

/etc/profile.d/proxyenv.csh
setenv http_proxy="192.168.36.204:8080"
setenv https_proxy="192.168.36.204:8080"
setenv ftp_proxy="192.168.36.204:8080"

Reference: Unofficial ISS Linux Web Pages

Converting HTML to text

I have used the following two scripts and found them to be not very impressive.

html2text (Python script)
Html2text (Perl script)

The Python script converts a HTML page into Markdown (a text-to-HTML format) which I don't want. I want text only.

The Perl script requires the input to be "normalized" by a program such as sgmlnorm before it could process it. Apart from this, the script doesn't work well for all the documents. It is limited to certain tags and has to be modified to get it to work for other tags. The text between the tags that are not handled just vanish from the output. Lets see if I can modify it to work for my documents atleast.