troubleshooting

Q:./cmd: error while loading shared libraries: xxx.so.0: cannot open shared object file: No such file or directory
A: Since we usually don't have root privilege, packages have been to installed to our home directory. export LD_LIBRARY_PATH so that app finds its lib files.

useful tips for c shell

default shell for redhat lab machines is c shell. 

startup script: ~/.cshrc

vi mode: bindkey -v (set -o vi for bash)

turn off system beep: xset -b

ls -cltr: sort by creation time. reverse

ls -ltr: sort by modification time

X11 Forwarding
If X11 Forwarding doesn't work even if you enabled it when ssh-ing, try install xauth first.

syntax highlight in less
http://blog.tersmitten.nl/archives/1015
grep|ls coloring: ls|grep --color=always hello|less -R

install fonts
installing fonts is necessary especially when using acroread for viewing PDFs. Lacking fonts can cause real ugly renderings. Run:

ttmkfdir
fc-cache -f [dirs]
download some free Microsoft fonts from here: http://avi.alkalay.net/software/webcore-fonts/

p.s. I found that evince usually does a better job than acroread. Even when the fonts are not embedded, the PDF still looks alright.

copy and paste with xterm.
usually copy/paste from xterm to X-Window clipboard is not well supported. It seems to handle copy/paste via its own buffer. Read this one: http://www.davidsimmons.com/soft/xtermhacks/

Or launch your xterm by this:

xterm -xrm 'XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)'

for loop on pairs http://compgroups.net/comp.unix.shell/for-loop-on-pair

bash prompt http://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html debugging under linux:
now I solely use gdbtui

'set args' to set up initial args
r,c,i,bt,n,s (as short as there is no ambiguity)
info b: list all breakpoints
finish
d(elete) num: delete break point num
display, und(isplay)
u(ntil): finish current loop
ret: return to caller
set va(riable) name=value
Ctrl-N/Ctrl-P: 
bt f
i(nfo) lo(cals)
dir

default command file: .gdbinit
or use 'source filename'

In some systems core dump files are disabled. Type 'ulimit -c unlimited' to enable it. Type 'ulimit -a' to check all the settings.
cut:

sort 
	-n: sort by numerical value
	sort -k4 -t, data/tmp_injects_small.csv |cut -f4 -d,|uniq|wc

ssh 
	ssh remote_machine top -n 1 -b|more
	ssh -t username@domain screen -d -r 

awk
	awk -F, '{print $1+0.1}' fn.txt
	simple stat: awk -F, '{a[$1]++;count++;} END {for (i in a) print a[i] " " a[i]/count *100 "% " i;}' prod1.csv

Get your top 10 Linux commands (copied from SMTH)
history | awk '{CMD[$2]++ ;count++ ;}END {for (a in CMD) print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n 10
Mine on my mac:
     1	129  25.8%  ls
     2	103  20.6%  cd
     3	28   5.6%   pwd
     4	21   4.2%   ulimit
     5	21   4.2%   sudo
     6	16   3.2%   vim
     7	15   3%     grep
     8	12   2.4%   find
     9	9    1.8%   man
    10	8    1.6%   wget

Mine on the server:
     1  215  21.5215%   ls
     2  110  11.011%    cd
     3  95   9.50951%   screen
     4  79   7.90791%   vim
     5  74   7.40741%   pwd
     6  66   6.60661%   cat
     7  48   4.8048%    ssh
     8  24   2.4024%    top
     9  20   2.002%     gmake
    10  17   1.7017%    ps

After several months:
     1  205  20.5%  ls
     2  127  12.7%  vim
     3  98   9.8%   cd
     4  68   6.8%   pwd
     5  59   5.9%   cp
     6  41   4.1%   cat
     7  39   3.9%   grep
     8  19   1.9%   ssh
     9  19   1.9%   perl
    10  16   1.6%   screen