Shayris
November 30, 2009 at 10:58 PM | In shayri | Leave a CommentTags: shayri
Garmiye hasrate nakaam se jal jate hein,
hum Chiragon ki tarha shaam se jal jate hein..
Shama jis aag mai jali hai numayesh ke liye,
hum usi aag mai gum naam se jal jate hein..
Jab bhi aata hai tera naam mere naam ke saath,
jane kyun log mere naam se jal jate hein…
na tha kuchch to KHuda tha, kuchch na hota to KHuda hota
duboya mujhko hone ne, na hota maiN to kya hota ?
Unhe Yeh Shikayat Hai Humse Ki,
Hum Har Kissi Ko Dekh Kar muskurate hain,
Nashamjh Hain woh kya jane,
Hame to har Chehre main woh hi nazr ate hain.
Jis shaam mein mere lab per aapka naam na aaye,
Khuda kare ki kabhi aisi shaam na aaye,
Ae jaane wafa yeh kabhi mumkin nahin ki,
Afsaana likhoon aur aapka naam na aaye.
Light Weight Web Servers (Light weight alternatives to apache)
November 25, 2009 at 3:28 PM | In Servers | 1 CommentLightweight web servers are Web servers which have been designed to run with very small resource overhead because of hardware, environment, or simply for the challenge of it.
Based on my research, following are the list of few web serves, which looks nice to me, based on few parameters like performance, resource utilization, size, active development, security etc.. Also, most of them are free and open source.
Lighttpd:- www.lighttpd.net
Nignix:- www.nginx.net
Cherokee:-www.cherokee-project.com
Thttpd:- www.acme.com/software/thttpd
Mathpod www.acme.com/software/thttpd
Jetty:- www.mortbay.org/jetty
Yaws:- http://yaws.hyber.org
mini_httpd:- www.acme.com/software/mini_httpd
But the above list is very small and you can find lot of others light web servers which suits your requirement.
Out of the above list, Lighttpd and Ngnix are the two most popular free, open source light weight web servers.
Comparison between these two servers:
http://hostingfu.com/article/nginx-vs-lighttpd-for-a-small-vps
http://superjared.com/entry/benching-lighttpd-vs-nginx-static-files/
http://www.wikivs.com/wiki/Lighttpd_vs_nginx
Comparison of different light weight web servers:
http://en.wikipedia.org/wiki/Comparison_of_web_servers
http://en.wikipedia.org/wiki/Comparison_of_lightweight_web_servers
List of web servers:
http://www.debianhelp.co.uk/apachealternatives.htm
http://www.linuxlinks.com/Software/Internet/WebServers/Mini_Servers
Adding script to run at startup or shutdown in Linux
March 10, 2009 at 3:45 PM | In Linux | 1 Comment1. Write a script and put it into /etc/init.d/ directory. Your script must have start or stop options or both, depends on when you want to run your script. start is called at reboot or system startup and stop is called at shutdown.
2. Add the executable permission to your script. Let say your script name is test
# chmod +x test
3. Create symbolic link in /etc/rc#.d where # is runlevel number. To know more about run level check /etc/initab or check init man page (type man init).
For example if you want to run your script at system startup, create a symbolic link in /etc/rc3.d:
- # cd /etc/rc3.d/
# ln -s ../init.d/scriptname S##scriptname where ## is order of executing script or you can say starting number. Use some 50 or 60. You should choose this number according to the needs of your application: if you try to make the application start too early, all disks may not be mounted yet, network adapters might not be initialized or some system services might not be started yet.
the rc script will start all scripts with a capital S in numerical order.
The shutdown portion is similar. Go to the run level that you want to shutdown at:
- cd /etc/rc0.d/
- ln -s ../init.d/scriptname K##scriptname where where ## is order of executing script or you can say starting number. Use some 50 or 60.
the rc script will shutdown all scripts with a capital K in numerical order.
sample script
#!/bin/sh
# Copy at startup and remove at shutdown
#
start() {
cp /etc/test /var/tmp/
}
stop() {
rm -rf /var/tmp/*
}
case “$1″ in
start)
start
;;
stop)
stop
;;*)
echo $”Usage: $0 {start|stop}”
RETVAL=1
esac
exit 0
4) Your process is done. Now you can test your script.
Few commands for runlevel and init
1) To switch to particular run level use init
$ telinit 6
2) chkconfig is a tool that helps in creating/deleting/changing the symbolic links. It requires that you put two specially-formed comment lines in your application startup/shutdown script:
#chkconfig –list to check the current startup settings
# chkconfig: 345 80 20
The numbers on the chkconfig line:
- The first number (345) is a list of runlevels you’ll want your application. So it will run at runlevel 3, and 5.
- 80 is the “starting position” number, meaning that this application will be started rather late in the boot process.
- 20 is the “shutdown order” number. Unless your application has special requirements, it is recommended that the sum of startup and shutdown order numbers for each application should be 100.
When you have added the two “magic” comment lines to your startup/shutdown script, just place the script to /etc/init.d and run:
chkconfig –add
If you need to temporarily block the system from starting/stopping the application automatically, you can use:
chkconfig off
To restore the auto-start function, use:
chkconfig on
Install packages on Linux…
March 10, 2009 at 12:12 PM | In Linux | Leave a CommentMake and install program from source (tar.gz)
- Put the packed file (tar.gz) in the directory you want it to be installed under.
- Open the compressed tar ball “tar zxvf <packagename>.tar.gz” . It will create a directory like “packagename-2.3.4″ and place the extracted information here.
- Go into the created subdirectory and type “./configure”.
- Type “make all”
- Type “make install”
RPM (Red Hat Package Manger) – Most common method of distribution of software for Linux. rpm command provides for installation, removal, upgrade, verification and other management of RPM packages.
1) Install new package – use rpm -i or rpm ihv for verbose information
#rpm -ihv gcc-2.96-113.i386.rpm
2) To upgrade a existing package to newer version -
#rpm -U binutils-2.11.93.0.2-11.i386.rpm
3) To remove a package
#rpm -e binutils-2.11.93.0.2-11.i386.rpm
Frequently used option in uninstall
–nodeps – skips dependency checking
–test – Run through all the motion except for actually installing things. Useful to verify that a package can be uninstalled correctly.
4) Query about package (-q)
-a display a list of all the packages installed on the system – rpm -qa
-f filename – display a package that contain file name
-R list packages on which this package depends
To know about any installed package
#rpm -ql <package_name> or rpm -qa|grep <package_name>
To list the files contained in the package
#rpm -qlp binutil.i386.rpm
Setting Environment variable in Linux
March 5, 2009 at 11:10 AM | In Linux | 2 CommentsThe following setting is for FC8 Linux. The file name or path may change for different flavor of Linux
For system wide effect , edit /etc/bashrc file and for particular user edit file home/<username>/.bash_profile and add your environment variable. For example, adding JAVA_HOME variable
#export JAVA_HOME=/usr/bin
Then save the file and run it using source command.
#source /etc/bashrc or source /home//.bash_profile
You can test it by
echo $<your_variable_name>
Install Internet Explorer 6 on Linux
February 18, 2009 at 6:19 PM | In Linux | Leave a CommentOpen a terminal. Log in as root to install wine and cabextract:
yum -y install wine*
yum -y install cabextract
Logout and install IEs 4 Linux with your normal user account:
wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux
GNU screen tutorial
February 12, 2009 at 2:35 AM | In Linux | 1 CommentScreen is best described as a terminal multiplexer utility. It allows you to have multiple virtual terminal instances over a single terminal connection.
Creating a new session
To start screen type screen on command prompt.
$ screen
or you can give screen name also
$screen -S <screen name>
Creating a new window
Type Ctrl+a c.
Every new created screen window is identified by an unique number. The first window (the one you’re actually using) is numbered as 0, while future windows will be labeled as 1, 2, 3 etc.
Switching between windows
a) Use Ctrl-a n and Ctrl-a p to switch to the next or previous window in the list and Ctrl-a space, to toggle through the shells.
b) Use Ctrl-a N, where N is a number from 0 to 9, to switch to the corresponding window.
c) Use Ctrl-a ” to get a full-screen list of windows. You can navigate this list with the arrow keys (or vi-style, with j and k), and pick a window to activate by pressing Enter when it’s highlighted. C-a w will give you a small, non-interactive list of windows.
Renaming Windows
Type Ctrl-a A, it will be prompted for a new window name.
Detaching and reattaching
Type Ctrl-a d for detach
$screen -r to re-attach or resume session
Sharing the session between multiple user
We’ll use a very simple scenario for this one. Let’s say Jake wants to share access to a screen session with Bob. Jake & Bob both have accounts on the system.
1. In order to enable multiuser mode the screen binary must be setuid for root.
# chmod u+s /usr/bin/screen
2. Jake starts a screen session.
jake$ screen -S shared
3. Jake must enable multiuser mode.
CTRL+a : multiuser on
This could be added to ~/.screenrc to have it enabled for all sessions, but case-by-case is probably safer.
4. Jake must add Bob to the access control list for his session.
CTRL+a : acladd bob
5. Bob lists the screen sessions that Jake has available.
bob$ screen -list jake/
There are several screens on:
1951.pts-1.testbox (Private)
1994.shared (Multi, attached)
2 Sockets in /tmp/screens/S-jake.
This shows us that Jake has 2 sessions. The second session named “shared” is a multiuser session & Jake already has it attached.
6. Bob attaches Jake’s multiuser session.
bob$ screen -x jake/shared
Bob could also connect using the PID.
7. Jake can check to see if Bob is connected to his session.
CTRL+a *
This brings up a list of users in a screen session.
term-type size user interface window
———- ——- ———- —————– ———-
xterm 80×24 bob@/dev/pts/11 0(email) rwx
linux 80×24 jake@/dev/tty1 0(email) rwx
[Press Space to refresh; Return to end.]
8. Jake can boot Bob from his screen session.
CTRL+a : acldel bob
Bob is immediately disconnected and sees…
[remote detached]
bob$
Monitoring
Say you’ve got a whole bunch of windows open. One of those windows is idling in a very inactive IRC channel. Since not much goes on in there, you don’t keep that window active but you would like to know when something is said. screen lets you monitor any window for activity by first switching to the window, and then hitting ^A M. When activity in that window occurs, screen will display a message at the bottom.
On the other hand, say one of your windows is a compile of X. There’s lots and lots of activity and you’d like to know when the build is finished. You can monitor for 30 seconds of inactivity by switching to the window and hitting ^A _. When the window goes silent, screen will display a message at the bottom.
These monitoring commands are toggles, so you can turn them off by switching to any monitored window and issuing the command again.
Copy and Paste
Here’s a feature that can be useful if you’re stuck in console mode & don’t have a mouse available. screen has its own built in buffer for copying & pasting text into the same or other windows.
1. Enter copy mode by pressing CTRL+a [
The status bar will read "Copy mode" with column & line information.
2. Move the cursor to the beginning of the block you wish to copy using standard vi keys or the arrow keys.
3.Press the ENTER key.
The status bar will read "First mark set" with column & line information.
4. Move the cursor to the end of the block you wish to copy using standard vi keys or the arrow keys.
5. Press the ENTER key.
The status bar will read "Copied X characters into buffer".
6. Paste the copied text with CTRL+a ]
Record linux shell session output
February 4, 2009 at 12:50 PM | In Linux | 2 Comments1) send command to start recording and saving the output into output.txt
#script output.txt
2) now execute any command, it will save it to the file output.txt. e.g.
#ls
3) exit to stop recording the session.
#exit
Now you can see the session output in any editor or cat command
#cat output.txt
How to format pen drive in Linux
January 13, 2009 at 2:41 PM | In Linux | Leave a CommentAbout device name in Linux : – Normally, Linux recognize first disk as sda, next is sdb, then sdc and so on. So if your system has one hard disk, it is sda and next added media (can be hard disk or USB or any other storage device) will be sdb. Their partition name will be sda1, sda2, sdb1 sdb2 etc.
Let us assume that /dev/sdb1 is your partition name for USB pen. Follow the steps below to format the pen drive.
1) Unmounting the device, using. To run the command you must be root user.
unmount /dev/sdb1
2) Use the mkfs.vfat command to format to FAT32 filesystem.
mkfs.vfat /dev/sdb1
3) That’s it!.Remove and insert again and start using it.
Basics of Lex and Yacc
December 12, 2008 at 12:24 PM | In LexYacc | Leave a CommentFollow the below link to get start on Lex and Yacc.
http://www.ecst.csuchico.edu/~bhsteel/250/examplesHandout/handout.html
http://ds9a.nl/lex-yacc/cvs/lex-yacc-howto.htm
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.