Awk

Single quote in awk

awk '{ print ",", foo$1foo }' foo="'"  file

Delimiter in awk -F, and the last column $NF
cat /etc/passwd | awk -F: ‘{print $5}’ | awk -F, ‘{print $NF}’

Field separator

awk '{ FS = "\t"; print $3 }' file

Line number: NR

Sum the number in a column, say column 1

awk '{ sum+=$1 } END {print sum}' file

VNC

Here are the three steps that I run VNC at my home.

1. Your Linux system might already have the software installed (type “which vncpasswd” to tell). If not, download the software from http://www.realvnc.com, and install it on your Linux and windows, respectively.

2. Launch from the server side (Linux)
$ vncpasswd
$ vncserver

3. Lanuch from the client (windows)
when prompted the server name, type linux_host_name:1, where linux_host_name is your linux box name and 1 is the port number for the vncserver, which could be a different port number sometime (you can tell it from the “vncserver” output at the previous step).

4. set kde

$ vi .vnc/xstartup

replace
twm &
with
startkde &

rsync

http://pkeck.myweb.uga.edu/ssh/

http://www.jdmz.net/ssh

1) make sure ssh and rsync are installed on both computers

2) at the visitor machine’s shell window, type the following command
$ cd /root/.ssh
$ ssh-keygen -t dsa -b 1024 -f visitor_machine_key

enter a BLANK passphrase

3) generate a file called “config” in the visitor machine under /root/.ssh/ with options like these
Host remote_host_machine
User root
Compression yes
Protocol 2
RSAAuthentication yes
StrictHostKeyChecking no
ForwardAgent yes
ForwardX11 yes
IdentityFile /root/.ssh/visitor_machine_key

4) Copy the /root/.ssh/visitor_machine_key.pub file and paste the file in or
at the end of the remote host machine’s file /root/.ssh/authorized_keys2