Thursday, January 22, 2009

How to count a particular word in VI?

If you want to count a particular word, say PROG, in a file, try this trick

:1,$s/zebra/&/g

or

if you want to count all words in a file, try

g [ctrl-g] at command mode

source: http://www.vim.org/tips/tip.php?tip_id=689

Some useful commands

df : report disk free space
gview : load VIM, improved vi editor
history : display a list of previous commands
!! : repeat previous command
ls -p grep "/" : list sub-directories in the current directory
touch file.ext : create a NULL file named 'file.ext'
vmstat : virtual memory status
uname : system information

How to kill a hanged/freezed application ?

Have you ever faced a hanged/freezed application while working at GUI of linux/sun etc?
If yes, this topic is for YOU.

Xkill is a utility for forcing the X server to close connections to clients. This program is very dangerous, but is useful for aborting programs that have displayed undesired windows on a user's screen. If no resource identifier is given with -id, xkill will display a special cursor as a prompt for the user to select a window to be killed.

We can use 'xkill' for a hard-to-kill frozen application. First, open a new terminal and type "xkill". After this your cursor will be a square-shaped.

Move to frozen findow and click.