Monday, August 20, 2007


Wednesday, August 15, 2007

Shut down computer in Xterm

NOT been tested yet. But they all sound like OK.
sudo shutdown -h now
gksudo shutdown -h now
sudo init 0

Sunday, August 12, 2007

Gnuplot to plot partial data

gnuplot> plot 'graphs' every ::1:6:4096:6 u 1:2 w l
This command plots the sixth block of data in data file 'graphs' from line 1 to line 4096; using 1:2 with line.

Definition of data block: Data blocks are separated by a single blank line in data file.
For example:
=================

abcde |----> #0 block

12345 |----> #1 block
12345 |
12345 |

abcde |----> #2 block

12345 |----> #3 block
12345 |
12345 |

abcde |----> #4 block

abcde |----> #5 block

12345 |----> #6 block
12345 |
12345 |

abcde |----> #7 block
=================
********************** The following comes from lanl.gov **********************

To specify a range of the data to be plotted, use the every option in the plot command. To skip every two lines, say plot "test.dat" every 2

When the data file contains several data blocks those are separated by a single blank line, you can skip the data block by the every option. To skip every two block, try plot "test.dat" every :2

every I:J:K:L:M:N
I Line increment
J Data block increment
K The first line
L The first data block
M The last line
N The last data block
every 2 plot every 2 line
every ::3 skip the first 3 lines
every ::3::5 plot from the 4-th to 6-th lines
every ::0::0 plot the first line only
every 2::::6 plot the 1,3,5,7-th lines
every :2 plot every 2 data block
every :::5::8 plot from 5-th to 8-th data blocks

Alternatively (if you are on the UNIX-like system), a part of your data file can be plotted by using the unix commands, "head" and "tail".

Wednesday, June 20, 2007

Check folder size and disk usage

du -h 'du = disk usage?' '-h = human readable'.
df -h 'df = the amount of disk space that is free on file systems'; '-h = human readable'.

Tuesday, June 19, 2007

Run program after logout (my version)

There are two ways I know so far:
1. nohup
nohup stands for 'no hang up' for me. For instance:
nohup ./script_run &
Then logout the server and power off your computer.
The script_run will keep running until it finishes or you log back in and stop it (kill the process).

2. screen
screen is rather more powerful tool. It can certainly do more (better) job than running a
program for you after you logout server. Well, that is the only function I am interested from it for now. So, how to use it? Example:
screen ------------This command will give you a new screen. Check xterm title.
Ctrl-a Ctrl-d ------Detach screen, whatever program you run in 'screen' is still running.
You can logout and even power off your computer now.
screen -x ---------Reattach screen. You can use any computer to login the server as the same user when runned screen. Terminal will show whatever program you were running before.

So, three commands: screen; Ctrl-a Ctrl-d; screen -x. Is that simple.
####################################################################
detatch screen from a screen:
ctrl-a
a
d
------------------------
ctrl-a,a is just to send ctrl-a to a screen session within a screen session.
It's all in screen's manpage. I always check manpage before asking Google.

Also, I like to turn on the caption line so I know whether I'm in screen or
not.
For example, put these two lines in your .screenrc
caption always
caption string "%{= RW} [%H] <%n>=%t%=%Y-%m-%d=%c "