/           The root of the overall file system namespace.
/bin       binary files of standard system commands. (a symbolic link to the /user/bin directory)
/dev      logical device names
/devices physical device names
/etc       host-specific configuration files and databases for system administration
/export  commonly shared file systems, such as user’s home directories, application software, …
/home    the default directory or mount point for a user’s home directory
/kernel   the directory of platform-independent loadable kernel modules that are required as part of the boot process
/mnt      temporary monunt point for file systems
/opt       application packages
/tmp      temporary files
/usr       programs, scripts, and libraries that are used by all system users.
/var       temporary, logging, or status files
/sbin      single-user bin directory

NOTE: /etc/inetd.conf:

inetd will load a network program based on a request from a network. The inetd.conf file tells inetd which ports to listen to and which server to start for each port.

Edit inetd.conf: disable services by commenting them out by adding a # at the beginning of a line, and then sending your inetd process a SIGHUP command to update it to the current inetd.conf file. (It concluds FTP, TELNET, SHELL, LOGIN, TALK, FINGER…etc)

#killall -HUP inetd

etc/nodename, etc/hosts, etc/defaultrouter, etc/netmasks, etc/resolv.conf (it contains the IPs of domain name servers)

etc/init.d contains initialization and termination scripts for changing init states.


The first time I heard about ‘awk’ was from an interview. After that, I took a quick look at this stuff and left it alone. Recently, I’ve got a chance to know it well. It is a C style programming language used to manipulate regularly formatted text (like Database dumps and System log files). The utility scans each line of a file, looking for patterns that match those given on the command line. If a match is found, it takes the next programming step. If not, it then proceeds to the next line.

Syntax: awk ‘{pattern + action}’ (filenames)

where pattern represents what AWK is looking for in the data, and action is a series of commands executed when a match is found.

My first try of awk:

#awk ‘{ print }’ /etc/passwd

Then the content of file passwd showed up. Yeah, that’s it. Simple, clean, easy!

Another try:

#awk ‘{ print $0 }’ /etc/passwd

In awk, $0 –>the current line, so print=print $0. If I try:

#awk ‘{ print “ILOVETHISGAME” }’ /etc/passwd

Ha, what did I get?! Not the file passwd, I saw ILOVETHISGAME everywhere instead. Cool!

To print specific fields in output. Awk works pretty well and efficient.

#awk -F”:” ‘{ print $1 }’ /etc/passwd

Note: -F defines “:” as field separator; print $1–>it prints the first field in each line of the input file. E.g:

#awk -F”:” ‘{ print $1 $3}’ /etc/passwd

Yeah, as your wish, awk will print out the 1st and the 3rd field(username and uid). But when I run it, it’s not perfect because there was no SPACE between username and uid. Later, I figured it out:

# awk -F”:” ‘{ print $1 ” ” $3 }’ /etc/passwd

That’s it!

There are a bunch of functions which are suitable for the different types of output. If you know the tricks, you make the deal. For example, it’s very suitable to make report form (especially in some special formatted cases)!


Il fait beau. C’est super chaud!! Quelle chaleur! Après avoir fait les choses sur mon agenda, j’ai commencé à toucher un p’tit peu le J2EE. C’est parti.

Two types of components deployed, managed, and executed on a J2EE Server.

  • Web Components (Servlet and JSP)
  • EJB Components
    • Session EJB: mapping business process flow
    • Entity EJB: maps a combination of data (usually based on an underlying data store and will be created based on that data within it)
    • Message-Driven EJB: very similar in concept to a session EBJ, but is only activated when an asynchronous message arrives.

A J2EE application will consist of the following:

  • Zero or more Web components packaged as Web Archives (WAR files)
  • Zero or more EJB components packaged as EJB-JAR files
  • Zero or more client components packaged as JAR files
  • Zero or more connectors packaged as Resource Archives (RAR files)

To this end, all of the components in a J2EE application are stored in a particular type of JAR file called an Enterprise Application Archive or EAR.

So far so good, a J2EE application server, like WebLogic, plus a database (DB2, Oracle, SyBase, MySQL, Access… whatever), and a SP maybe, this solution fit for the current trend in today’s enterprise program development and n-tier frameworks aimed at delivering applications that are secure, scalable, and availab.e

I feel that it’s time to get my SQL back gradually after building a Webserver. Again, from the very beginner level — to the geek! (I’M NOT A GEEK AT ALL, TO BE REMEMBERED PLEASE!! Actually I think that everything if I start to addict to, it only takes me several days to ramp up from a beginner level to top level! That’s really true! 🙂 )

Basically there are three basic categories of SQL Statements:

  • SQL DATA STATEMENTS (query and modify tables and columns)
    • SELECT Statement – query tables and views in the db
    • INSERT Statement – add rows to tables
    • UPDATE Statement – modify columns in table rows
    • DELETE Statement – remove rows from tables
  • SQL TRANSACTION STATEMENTS (control transactions)
    • COMMIT Statement – commit the current transaction
    • ROLLBACK Statement – roll back the current transaction
  • SQL SCHEMA STATEMENTS (maintain schema)
    • CREATE TABLE Statement – create tables
    • CREATE VIEW Statement – create views
    • DROP TABLE Statement – drop tables
    • DROP VIEW Statement – drop views
    • GRANT Statement – grant privileges on tables and views to other users
    • REVOKE Statement – revoke privileges on tables and views from other users

Playing around With the OracleDB10 for a while, I used the following SQL commands:

SQL select, distinct, where, and, or, in, between, like, order by, count, group by, having, alias, join, minus, outer join, arithematic functions such as AVG, COUNT, MAX, MIN, SUM.

Is it deep enough? No…Back to digging…

1. Go to /opt/sysconfig (#cd /opt/sysconfig)
2. edit file named i18n (#gedit i18n)
3. This is the original file:


4. I changed it as follows:


5. Restart the computer.

PS: everything looks good, using ctrl+space I can switch between ENG and CHN. One minor thing is that I wanna get french involved. Well, it’s not that I’m completely fluent in French, but I just wanted to be able to type a few things from time to time, so I had to  get goint and play around with my favorite Linux (I think I have gotten addicted to Red Hat…need a break…) …and Eventually I figured it out and here are my tricks!

Startx in Linux, there is a small tool called “Character Palette” which you can add to the bottom panel. It provides a convenient way to access accented characters, special symbols, etc. Now I can work on Linux freely! C’est tellement cool 🙂 Maybe there is another way to fix it, tell me if you do have.

Dreaming of blogging on my own Web Server, studying for a while, I started to build my own Web Server. The linux distribution being utilized for this tutorial is Red Hat Enterprise Linux 3, however the steps should be very similar across most distribution. Be sured that you have the required development tools loaded for compiling programs from the source, these tools are beyond the scope of this doc and will not be covered here. In addition, it assumes you can use a text editor (e.g.: gedit, vi, emacs, etc) for basic editing tasks. Are you ready? — COOL! Here we go! 🙂

1. Grab 3 Sourcecode

2. Installation

Beginning now we will be working as root, sitting on a big sofa….with a cigar, ….change to the directory in which you saved your downloaded files and iyou can use su command f you want to become root, okay, then type the following comands:

# tar xzvf httpd-2.2.2.tar.gz (enter)
# tar xzvf mysql-4.0.27.tar.gz (enter)
# tar xzvf php-5.1.4.tar.gz

Having done these, now lets move on to compiling the source into usable programs. We will start with Apache.

3. Compiling Apache – follow these commands by typing:
#cd httpd-2.2.2 (enter)
#./configure –prefix=/usr/local/apache2–enable-mods-shared=most (enter)
(This telles Apache to install in the /usr/local/apache2 directory and to build most of the available loadable modules. Well, of course you have a bunch of options with Apache, but these should work for the most part. Once the configuration is done and the system returns the prompt to you, type the following command)

#make (it takes me several minutes, issue the following command once the prompt comes back again)
#make install
(Me voila Apache is installed! Bravo!)
We still need to make a few minor changes as follows:

# gedit /usr/local/apache2/conf/httpd.conf
or # emacs /usr/local/apache2/conf/httpd.conf
or # vi/usr/local/apache2/conf/httpd.conf

Then check the following line is present in the httpd.conf file at the bottom of the LoadModule list, add it if it is not there;

LoadModule php5_module modules/libphp5.soNote if you download php 4.x.x you should change as:
LoadModule php4_module modules/

Find the DirectoryIndex line and edit it like the following;

DirectoryIndex index.html index.html.var index.php

Find the AddType application section and add the following line;

AddType aplication/x-httpd-php .php

C’est tout! Save the file and we are done with Apache part. Let’s move on to MySQL!

4. Compiling MySQL
#cd mysql-4.0.27 (enter)
# ./configure –prefix=/usr/local/mysql –localstatedir=/usr/local/mysql/data –disable-maintainer-mode –with-mysqld-user=mysql –enbale-large-files-without-debug (enter)
#make install

Note that the above commands you may not need if you have downloaded mysql recently cause the current one is ready-to-run version.
Now let’s create a group for MySQL as follows:
#/usr/sbin/groupadd mysql (enter)
Now let’s creat a user called mysql which belongs to the mysql group;
#/usr/sbin/useradd -g mysql mysql (enter)
Then we install the db files as follows; (you might not need this step if you use the ready-to-run version)
#./scripts/mysql_install_db (enter)Okay, then we make some minor ownership changes;
#chown -R root:mysql /usr/local/mysql (enter)
#chown -R mysql:mysql /usr/local/mysql/data (enter)
still, using emacs/vi to add a line the file as follows:
#gedit /etc/
Adding the following line:
We are done! MySQL is installed! To run it, just issue the following command:
#/usr/local/mysql/bin/mysqld_safe –user=mysql &

the following command is optional, you can set a root password for MySQL as follows:
#/usr/local/mysql/bin/mysqladmin -u root password new_password
where new_password is the password you wanna use.

Okay, last monster-PHP!
5. Compiling PHP

(To be continued–Après la pause…)

Friday, July 28, 2006

Attention: yesterday I found that PHP 5.1.4 doesn’t fit for my current environment, it needs more high version of xm..stuff  😡 . So, I downloaded php 4.4.2 instead. C’est super! 🙂  Okay, follow me to compile php 4 by typing:

#cd /opt/php4.4.2 (enter)
#./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql=/usr/local/mysql (enter)
#make (enter)
#make install (inter)
Okay, grab a beer for a while till you have the prompt back, then type:
# cp php.ini-recommended /usr/local/php/lib/php.ini (enter)Then edit that file;#gedit /usr/local/php/lib/php.ini (enter)

And change the following: 
Find the doc_root section and enter the correct path for the directory which serves your web content such as:

doc_root= “/usr/local/apache2/htdocd/”

(this is default for apache2) Then find the file_uploads section and change it to reflect the following (for security reasons):


Wonderful! C’est fini! Let’s test!

6. Testing
Use ps command to check if your MySQL process is still running from earlier, if not, start it again! Then we need to start Apache by issuing the following command which starts the Apache web server:

#/usr/local/apache2/bin/apachetl start (enter)

now change into the following directory and using gedit create a file called test.php:

#cd /usr/local/apache2/hotdocs (enter)
#gedit test.php

and add the following line to the file:

<?php phpinfo(); ?>

Save the file, then open a browser (firefox) and point it to /localhost/test.php. You should see a listing of all kinds of cool info about PHP, Apache, etc. Now, I end up my first time fully functioning setup. However, during the whole setup process, I got some problems and I figured them out, so hopefully you don’t have so much troubles, if you do have, then GOOGLE or ask me, I will try my best to help you. :mrgreen:

Okay, let’s do something to celebrate, BBQ, having some champagne…Yeah we made it!

Well, now we have everything running now, the only minor problem is that we have to start Apache and MySQL manually, I’m a bit lazy and I do not want to have to remember to do everytime I reboot, so I wanna fix it. I found a way which is pretty good, but it seems that I need a while to get it done! Hopefully tomorrow I can work it out.

7. Starting Apache and MySQL automatically

July 30, 2006

Finally, I made it. Let’s start with MySQL. Logging in as root and with the mysql directory we set earlier.
#cd /usr/local/mysql/ <enter>

then copy the file mysql.server to the directory /etc/init.d as follows;
#cp support-files/mysql.server /etc/init.d/mysql

Now, let’s create some links in the startup folders fur run level 3 and 5;

#cd /etc/rc3.d <enter>
#ln -s ../init.d/mysql S85mysql <enter>
#ln -s ../init.d/mysql K85mysql <enter>
#cd /etc/rc5.d <enter>
#ln -s ../init.d/mysql S85mysql <enter>
#ln -s ../init.d/mysql K85mysql <enter>
#chmod 755 mysql <enter>
We’re done for MySQL, it should start automatically now when you reboot your machine (use ps -ef | grep to check if you want). Now let’s do the same steps for Apache, still, as root and with the apache2 directory configuration as we did before.

#cd /usr/local/apache2/bin <enter>
#cp apachectl /etc/init.d/httpd <enter>
#cd /etc/rc3.d <enter>
#ln -s ../init.d/httpd S85httpd <enter>
#ln -s ../init.d/httpd K85httpd <enter>
#cd /etc/rc5.d <enter>
#ln -s ../init.d/httpd S85httpd <enter>
#ln -s ../init.d/httpd K85httpd <enter>

Cool! The apache should start automatically along with MySQL the next time you boot your machine.

Well, having done this, I could setup a webserver and to build my WordPress in, and have a powerful blog site later! Yeah! I wrote the whole procedure down because I want to get it noted and hopefully it helps you guys. Ciao.

Some OS X’s BSD/unix command-line

  • Basic Navigation (cd, pwd, ls)
  • Manipulating Files & folders (cp, rcp, ditto, mv, rm, rmdir, mkdir, chmod, chflags,chown, chgrp)
  • Working with text files (more, less, grep, pico, vi, emacs)
  • Pipes and Redirects (>, >>, <, |, tee)
  • Miscellaneous (man, find, locate, open, apropos)
  • Administration (ps, top, kill, su, sudo, lsbom, lsof, ifconfig, diskutil, netstat)
  • Single-user mode (fsck, mount, SystemStarter, pico, nicl, bless, exit, reboot, shutdown)

Control Characters:

  • Ctrl-C –> Terminates the command currently running
  • Ctrl-D –> Indicates end-of-file or exit
  • Ctrl-U –> Erases all characters on the current command line
  • Ctrl-W –> Erase the last word on the command line
  • Ctrl-S –> Stops output to the screen
  • Ctrl-Q –> restarts output to the screen after you have pressed Ctrl-S.

Other commands not metioned above but I used before:
quot, useradd, passwd NEWUSER1, smuser add, usermod, userdel, smuser delete, groupadd, group mod, groupdel, file, more, cat, head, tail, wc, lp, lpstat, cancel, touch, find, history, cal, sleep, rlogin, uname, telnet, ftp, get, mget, mput, bin, bye, tar, jar, gzip, gzcat, zip, unzip, who, rusers, finger, last, whoami, groups, id, prstat.

Next Page »