usage tips for Linux

# to search for a key word in files with certain extension
find . -iname "*.cc" -exec grep -Hin "thekeyword" {} \;
# -i to ignore case
# -H will print out the file name which matches to the filter
# -n will print out the matching line number

#if you want to use some filter containing escape char, use single quote
find . -name "*.cc" -exec grep 'setData(\"Pass'  {}\;

#to count the number of occurrence of certain word/pattern in vim
:%s/pattern//gn

# to count number of files in a directory
find . -type f | wc -l

# to change command prompt to { $user_name+@+$hostname +":" + $cwd> }
set prompt="\n%{\033[0;32m%}%n@%m:%{\033[0;33m%}%~%{\033[1;30m%}>%{\033\[1;37m%} "

# to use backspace to delete
stty erase ^H

# to pipe error and cout to file; for tcsh and csh only
./genKB_DA.sh >& ./log.txt

# about FTP downloading
use 'hash' to show download progress
use 'prompt' to turn off the 'y/n' prompt which blocks mget

# to check linux kernel version
uname -r

# to check red-hat version
cat /etc/redhat-release

# log in first as 'test' user, and then type the following to allow any user to access current x11 display
xhost +localhost

# to batch delete files based on strings in a file
xargs rm < ../fxxTN1.txt