Saturday, December 8, 2007

compiz-fusion-0.6.99 for F8 complete with fusion-icon

I got all information about this post from the following link:
http://www.fedoraforum.org/forum/showthread.php?t=171130
The reason I copy-paste the original post is because THE idea worked for me.

Sunday, November 11, 2007

mount, umount and ln -s

sudo mkdir /media/eagle
sudo mount /dev/sdb2 /media/eagle

For automatically mount, edit /etc/fstab
sudo vim /etc/fstab
Add the follow line the the end of fstab file:
/dev/sda2 /media/eagle ext3 defaults 1 2

Example:

/etc/fstab

automount

Being able to mount filesystems manually is all well and good. But I want to mount a whole bunch of filesystems at boot up time. To do that, I set up /etc/fstab with a descriptions of all my filesystems that are to be automounted.

/etc/fstab has a simple format. One filesystem per line, 6 columns per line, separated by white space. The first four columns are the same information you type in when using mount manually.

  • first column - the device to mount
  • second column - the mount point
  • third column - the filesystem type
  • fourth column - options (-o)

The last two columns contain two numbers.

  • fifth column - which filesystems need to be dumped, that is - backed up with the dump utility. As Slackware no longer comes with the dump backup utility, you can safely ignore this column. The Slackware installation sets this column to 1 for non-removable real filesystems. I've just left it as is.
    • 0 = does not need to be backed up with dump
    • 1 = needs to be backed up with dump
  • sixth column - used by fsck to determine the order that file system checks are done at reboot time
    • root partition should have 1 here
    • other filesystems should have 2 here
    • filesystems that do not need fsck, or filesystems that are not always mounted, or removable media should have 0 here

Some special file system types can be included in /etc/fstab. The three most common ones are the swap partitions, the /proc pseudo device, and the /dev/pts pseudo terminal directory. These will be set up for you ate installation time, and you shouldn't need to fiddle with them.

Here is my fstab set up for the systems that I want loaded at boot time.

/dev/hdb2      swap          swap     defaults         0   0
/dev/hdb1 / ext3 defaults 1 1
/dev/hdb3 /usr ext3 defaults 1 2
/dev/hdb5 /usr/local ext3 defaults 1 2
/dev/hdb6 /opt ext3 defaults 1 2
/dev/hdb7 /home ext3 defaults 1 2
/dev/hdb8 /data ext3 defaults 1 2
/dev/hda1 /mnt/dosc vfat defaults,uid=1000,gid=100,umask=022 1 0
/dev/hda5 /mnt/dosd vfat defaults,uid=1000,gid=100,umask=022 1 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
mp3:/mnt/mp40 /mnt/music1 nfs defaults 0 0
mp3:/mnt/mp80 /mnt/music2 nfs defaults 0 0

Install Fedora

1. Preparation
A) Back up data. Don't forget you ".mozilla" kind of files/folders. A list:
.vimrc .bashrc .thunderbird .mozilla .gnuplot-history . . .
and of course, your personal important data!!
If your data are in different partition from system ( everybody should install system this way. Keeping system files and personal data in one drive/partition is Windoz way.), make sure you just link to that partition. DO NOT make that partition /home or what so ever. Symbolic link is the easiest way to handle this, because when you install new system (every half year for Fedora), just simply format / partition (probably swap partition too). Leave data partition alone (Don't do anything about it). After the fresh installation. Symbolic link is your friend. This way, you don't even need to back your data . Really? Oh, well, it is always a good idea to periodically back up data, isn't it? I am sure you already have your data in a safe place.

Oh, you don't know howto setup symbolic link? google it.
ln -s /media/WD-drive/simulation /home/joying/simulation

How to remove the link?
unlink simulation

B) Download images from fedora project website. The mirrors in US is not necessarily faster (or broader band).

2. Installation
A) Install from DVD(all). This is the easiest way to do.
B) Install from hard drive for old laptops which has no DVD-rom. Make a rescue disc, then boot the computer using rescue CD. Choose install from hard drive. Now, make sure you have ISO file in the hard drive.

3. Tweak it (In the way you want it to be)

Symbolic link

ln -s [target] [from]

Example:
You don't have simulation folder in your home directory yet now. But you DO have a simulaion directory in another hard drive/ partition. You want to set up a link in your home folder ( /home/joying/simulaion) to a different partition/hard drive ( /media/_home/simulation).
SO the command would be:
ln -s /media/_home/simulation /home/joying/simulation

If you want to remove the link,
cd /home/joying
unlink simulation


########################################

When using the rm or unlink command to remove a symbolic link to a directory, make sure you don’t end the target with a ‘/’ character because it will create an error. Example:

$ mkdir dirfoo
$ ln -s dirfoo lnfoo
$ rm lnfoo/
rm cannot remove directory ‘lnfoo/’ : Is a directory
$ unlink lnfoo/
unlink: cannot unlink ‘lnfoo/’: Not a directory
$ unlink lnfoo
$

Notice how one complains it “Is a directory”, but the other complains it is “Not a directory”, which I found confusing. This is a problem if you have a tendency to use tab completion a lot, because it will stick a ‘/’ at the end.

Sunday, October 21, 2007

how to transfer data using scp

scp from to
scp data.tgz username@server:~/
-------- -----------------------
from to

Tuesday, September 18, 2007

Change tty terminal font size

sudo vim /boot/grub/grub.conf

add 'vga=796' at the end of kenel line
for instance:
kernel /boot/vmlinuz-2.6.22.5-76.fc7 ro root=LABEL=/1 rhgb quiet vga=796

what number should you use instead of 796? Check this page out:
http://en.wikipedia.org/wiki/VESA_BIOS_Extensions
or google VESA BIOS :-)

OK, some people, like me, don't use vesa driver. So what number should we use? check the following link out:
http://www.linuxquestions.org/questions/linux-hardware-18/terminal-window-resolution-better-than-80x24-63927/

Linux video mode numbers

The Linux kernel allows user configuration of VESA modes at boot time using the 'vga' kernel parameter. This parameter does not directly accept VESA video mode numbers; instead, a Linux video mode number must be calculated using the VESA number.








1024×640 1024×768 1152×720 1280×1024 1440×900 1600×1200
16 color palette






772
774

256 color palette





874 773 869 775 864 796
15-bit (5:5:5)





875 790 870 793 865 797
16-bit (5:6:5)





876 791 871 794 866 798
24-bit (8:8:8)





877 792 872 795 867 799
32-bit (8:8:8)1





878 824 873 829 868 834

1: 32-bit is really (8:8:8:8), but the final 8-bit number is an "empty" alpha channel. It is otherwise equal to 24-bit color.

Tuesday, September 11, 2007

What is laser mode?

I posted this question some time ago. It might be a good time to answer this before questions pile up.

There are basically 'two kinds of laser modes': transverse mode and longitudinal mode. Sometimes, transverse modes are labeled as TEM modes, such as TEM00, TEM01, TEM11. Longitudinal modes are also called cavity modes or axial modes. TBC

Tuesday, September 4, 2007

awk 'last pass power'

awk '$1~/300/{print $1,$2}' output.* | tee -a /dev/tty lastpass.txt

Tuesday, August 28, 2007

Creat trash icon on desktop

1)Go to ~/Desktop/
2)create file named trash.desktop
3)open this file in a text editor
4)put following code in it:

"[Desktop Entry]
Type=Link
URL=trash:/
Encoding=UTF-8
Icon=trashcan_full
EmptyIcon=trashcan_empty
Name=Trash
Comment=Contains removed files
OnlyShowIn=KDE"

5)save and voila!

Remember, you can always access your trash from konqueror if you type trash:/ in the address bar

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 "

Run program on server after logout(screen)

How to use it (in an easy tutorial fashion)

1. screen %% To open a screen

2. commands %% Run whatever program you wanted to run

3. Ctl+a Ctl+d %% To detach screen

4. screen -x %% To attach screen

5. screen -r pid# %% To attach to the 'pid#' screen if there are more than one screens

========== DONE ==========

GNU screen is a terminal multiplexer, i.e. it lets you run many command-line applications from one console or terminal emulator window.

It is a powerful tool and mainly used in a terminal by a single user who needs to run several programs at once but does not want to log in several times on several terminals - a time consuming business on a dial up connection. Its greatest virtue is that sessions can be detached in one terminal and re-attached in another. This means that you can start a session at the office, go home, log in remotely, and re-attach the session locally. Think of it as the TTY version of VNC. If your dial-up session dies, you can simply reconnect and reattach the screen session - you won't lose any work.

Another underrated benefit is that you can switch between terminals without resorting to the mouse.

It is also very useful as a teaching, demonstration or co-operative working tool. Say you want to share a session with a remote user or show how to use a program. You both have to log into the same computer using the same user name. One user runs the command screen and then the other user runs the command screen -x

If there are multiple screen sessions available, the program will then list the available screen sessions. For example:


   There are screens on:
2463.pts-2.atreus (Attached)
11068.lab (Attached)
2 Sockets in /tmp/screens/S-keithh.

In this case, the user can explicitly specify the desired session using an unambiguous substring of the session name. In the above example, screen -x 11068 and screen -x lab are equivalent and both users will now share the same session. Because each session can contain multiple PTYs, each user can independently switch between the them. They can also share the same PTY in which case they will each see the same display and can each type commands.

Contents

[hide]

[edit] Using Screen

Screen can be controlled while it is running by prefacing commands with the command-key character. By default, this is Control-A. For instance, to view the help screen enter Ctrl-a ? The detach command is Control-a Control-D.

Control-a, Control-c creates a new terminal screen

Control-a, " shows a list of terminal screens

Control-a, n switch to the next screen

[edit] Customizing Screen

The man page for screen details a large number of options but the following examples will illustrate many of the more useful features. By default, screen checks for a ~/.screenrc file and failing that the /etc/screenrc file. Here is my default screenrc:


defflow auto

# Scrollback buffer size in lines
defscrollback 5000

# modify the termcap/terminfo when I'm using XTerm.
terminfo xterm* LP

# Support alternate screens so that, for example, when you
# quit out of vi, the display is redrawn as it was before vi
# redrew the full screen.
altscreen on

# don't display the copyright page
startup_message off

# detach on hangup - if my dial-up session fails, screen will simply
# detach and let me re re-attach later.
autodetach on

msgwait 2 # 1 second messages

# Start a number of initial shells and give them titles which show up in the status-line
screen -t CCase 0 bash
screen -t Sun1 1 bash
screen -t Sun2 2 bash
screen -t CCase 3 bash
screen -t Rich 6 bash
screen -t Pine 7 bash
screen -t Pine 8 bash
screen -t News 9 bash
screen

# remove some stupid / dangerous key bindings
bind k
bind W
bind ^k
bind .
bind ^\
bind \\
bind ^h
bind h
#make them better
bind 'K' kill
#bind 'I' login on
#bind 'O' login off
#bind '}' history
bind 'W' windowlist

I can create an alternate configuration file as follows:


...
sessionname lab # Call this session "lab"

caption always # Leave the status line on permanently
caption string "LAB %t - %w"

msgwait 2 # 1 second messages
screen -t CP 0 bash
screen -t CAC 1 bash
screen -t FTP 2 bash
screen -t xterm 3 bash
screen
...

This can be made easier to use by defining an alias for the command:

  • screen -d -R lab -t LAB -c ~/.screenrc-lab

The -d -R lab option means detach and resume the session named lab and if no such session exists then create it.

The -t LAB option simply puts a title on the status line.

And -c ~/.screenrc-lab specifies the alternate configuration file to use.

Run program on server after logout (nohup)

nohup is a command used to run a process and have it continue to run regardless whether you log out and close the connection to a server.

When you are connected to a server and wish to log out, a hangup (SIGHUP) signal is sent to all the processes you have run. Using nohup to run a program causes this signal to be ignored.

For example, you might want to download some files with wget, and be able to log out and have these files still download for you. One could use

nohup wget --quiet http://www.example.com/some_large_file &

to have wget download these files in the background, and continue to do so even after you log out. The quiet flag is set because while wget is in the background, the job will suspend if it creates any output to the terminal.

The use of nohup is not restricted to remote logins, however, one can use it for example in X, with an xterm open, one can nohup a process and have it run even if the xterm is closed.

Thursday, May 31, 2007

Linux make iso file

make iso
mkisofs -dvd-video -o dvd.iso /media/dvd

burn DVD
growisofs -dvd-compat -Z /dev/hdc=dvd.iso

growisofs -dvd-compat -Z /dev/dvdrw=DVD.iso

linux command grep tee cat

grep 'macropulse' output* | tee -a /dev/tty macropulse.txt

grep pattern 'macropulse' all files with name output* Then, print the info on screen (/dev/tty) and write the info into a file macropulse.txt (-a option means don't overwrite the file).

grep -n 'macropulse\|noise' output* | tee /dev/tty macropulse.txt

-n option means with line number; 'macropulse\|noise' means two patterns 'macropulse' and 'noise'.

Tuesday, May 29, 2007

AMFEL?

This might be an interesting idea. siegman1051.

Friday, May 25, 2007

PDFTK --pdf tool kit

If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents. Keep one in the top drawer of your desktop and use it to:

  • Merge PDF Documents

  • Split PDF Pages into a New Document

  • Rotate PDF Pages or Documents

  • Decrypt Input as Necessary (Password Required)

  • Encrypt Output as Desired

  • Fill PDF Forms with FDF Data or XFDF Data and/or Flatten Forms

  • Apply a Background Watermark or a Foreground Stamp

  • Report on PDF Metrics such as Metadata, Bookmarks, and Page Labels

  • Update PDF Metadata

  • Attach Files to PDF Pages or the PDF Document

  • Unpack PDF Attachments

  • Burst a PDF Document into Single Pages

  • Uncompress and Re-Compress Page Streams

  • Repair Corrupted PDF (Where Possible)

Pdftk allows you to manipulate PDF easily and freely. It does not require Acrobat, and it runs on Windows, Linux, Mac OS X, FreeBSD and Solaris.


Examples

Merge Two or More PDFs into a New Document
pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf
or (Using Handles):
pdftk A=1.pdf B=2.pdf cat A B output 12.pdf
or (Using Wildcards):
pdftk *.pdf cat output combined.pdf
Split Select Pages from Multiple PDFs into a New Document
pdftk A=one.pdf B=two.pdf cat A1-7 B1-5 A8 output combined.pdf
Rotate the First Page of a PDF to 90 Degrees Clockwise
pdftk in.pdf cat 1E 2-end output out.pdf
Rotate an Entire PDF Document's Pages to 180 Degrees
pdftk in.pdf cat 1-endS output out.pdf
Encrypt a PDF using 128-Bit Strength (the Default) and Withhold All Permissions (the Default)
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foopass
Same as Above, Except a Password is Required to Open the PDF
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz
Same as Above, Except Printing is Allowed (after the PDF is Open)
pdftk mydoc.pdf output mydoc.128.pdf owner_pw foo user_pw baz allow printing
Decrypt a PDF
pdftk secured.pdf input_pw foopass output unsecured.pdf
Join Two Files, One of Which is Encrypted (the Output is Not Encrypted)
pdftk A=secured.pdf mydoc.pdf input_pw A=foopass cat output combined.pdf
Uncompress PDF Page Streams for Editing the PDF Code in a Text Editor
pdftk mydoc.pdf output mydoc.clear.pdf uncompress
Repair a PDF's Corrupted XREF Table and Stream Lengths (If Possible)
pdftk broken.pdf output fixed.pdf
Burst a Single PDF Document into Single Pages and Report its Data to doc_data.txt
pdftk mydoc.pdf burst
Report on PDF Document Metadata, Bookmarks and Page Labels
pdftk mydoc.pdf dump_data output report.txt

Tuesday, May 22, 2007

CUPS in Fedora

go to firefox:
http://localhost:631/

Tuesday, May 15, 2007

External Command in VIM

  1. ':shell' or ':sh' to go into shell, once you finish. use 'exit' to go back to vim.
  2. Can also use ':! command' to run command in vim.
  3. Use ':r file.txt' to insert file.txt into the file you are editing.

Sunday, May 13, 2007

Joining PDFs the Ghostscript way

To use Ghostscript to combine PDF files, type something like the following:

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf

Unless you're very familiar with Ghostscript, that string of commands won't mean much to you. Here's a quick breakdown:

  • gs -- starts the Ghostscript program
  • -dBATCH -- once Ghostscript processes the PDF files, it should exit. If you don't include this option, Ghostscript will just keep running
  • -dNOPAUSE -- forces Ghostscript to process each page without pausing for user interaction
  • -q -- stops Ghostscript from displaying messages while it works
  • -sDEVICE=pdfwrite -- tells Ghostscript to use its built-in PDF writer to process the files
  • -sOutputFile=finished.pdf -- tells Ghostscript to save the combined PDF file with the name that you specified

Transform limited spectrum

From RP photonics:

In ultrafast optics, the transform limit (or Fourier limit, Fourier transform limit) is usually understood as the minimum pulse duration which is possible for a given optical spectrum of a pulse. A pulse at this limit is called transform-limited. This condition of being at the transform limit is close to (although not exactly identical with) the condition of a frequency-independent spectral phase (which leads to the maximum possible peak power), and basically implies that the time-bandwidth product is at its minimum and that there is no chirp.

Many mode-locked lasers, particularly soliton lasers, are able to generate close to transform-limited pulses. Processes such as dispersion or optical nonlinearities can cause chirp and thus can lead away from the transform limit. Non-transform-limited pulses may be brought to the transform limit (and thus temporally compressed) by modifying their spectral phase, e.g. by applying a proper amount of dispersion or a pulse shaper. This is called dispersion compensation. For not too broad spectra, compensation of second-order dispersion is often sufficient, while very broad spectra may require compensation also of higher-order dispersion in order to get close to the transform limit.

Using and Porting GNU Fortran

System Intrinsic (function)

System(Command)

System: INTEGER(KIND=1) function.

Command: CHARACTER; scalar; INTENT(IN).

Intrinsic groups: badu77.

Description:

Passes the command Command to a shell (see system(3)). Returns the value returned by system(3), presumably 0 if the shell command succeeded. Note that which shell is used to invoke the command is system-dependent and environment-dependent.

Due to the side effects performed by this intrinsic, the function form is not recommended. However, the function form can be valid in cases where the actual side effects performed by the call are unimportant to the application.

For example, on a UNIX system, `SAME = SYSTEM('cmp a b')' does not perform any side effects likely to be important to the program, so the programmer would not care if the actual system call (and invocation of cmp) was optimized away in a situation where the return value could be determined otherwise, or was not actually needed (`SAME' not actually referenced after the sample assignment statement).


Friday, May 11, 2007

iTunes on Linux?

Banshee is the first one I tried. It is not as good as I wish. Another thing called crossoffice may worthy some time to try when I have spare time which I normally don't.

Sunday, May 6, 2007

Wednesday, May 2, 2007

VNC over SSH

VNC over SSH is one of the secure ways to remotely access computer desktop.

At the server side (the remote computer which you want to log to):
vncserver :64 -geometry 1024x768 -depth 16 -name user

At the viewer side (the local computer you are using now):
vncviewer -via 192.168.1.2 localhost:64

192.168.1.2 is the server' IP.

After you finish, kill the process at server:
vncserver -kill :64

Tuesday, May 1, 2007

ssh -X command

Log in a computer as
ssh -X user@sever
One can use some command to get GUI work. Such as:

firefox & (which can view files by enter file:///home/user)
nautilus &
konqueor &

Gnuplot (plot part of data file)

A good reference website: http://t16web.lanl.gov/Kawano/gnuplot/datafile2-e.html

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".

Thursday, April 19, 2007

Questions

  1. What are laser modes (longitudinal and transverse)?
  2. Simple question, can I see them? --show me!
  3. Where do they come from? where do they go? why do we care about them? what can we benefit from understanding the laser mode dynamics?
  4. Another straight question, can I manipulate laser modes (longitudinal and transverse)? if yes, how?
  5. What are origins of laser modes (longitudinal and transverse)? --in details!
  6. How do they develop from noise? --in details

Saturday, April 14, 2007

PALI TRAIL





After a long week working, pali trail is a good place for refreshment. Plus, it has excellent views too.

Thursday, April 5, 2007

Linux command cheat sheet

Linux Cheat Sheet

Getting Around in the File System
pwd
Path of working directory - tells you what directory you are in

ls
List - Lists the files in the current directory

ls -l

Lists the files and their attributes

cd

change directory - Change to the directory specified

Dealing with Files

cp

copy - Make a copy of a file

cp -R

Make a copy of a directory

mv

move - Move or rename a file

rm

remove - Delete a file

more

Page through a file.

grep

Search a file for a keyword

vi

Edit a file. (See Ruling WebGUI's vi Cheat sheet for details>

chmod

change mode - Change the mode or permissions on a file.
Mode = ogw or owner, group, world permissions. example: 755
0=nothing
4=read
5=read / execute
6=read / write
7=read / write / execute

chown

change owner - Change the owner of a file

Dealing with Environment Variables

export =

Set and environment variable in teh current shell.

set

Show all of the current envireonment variables that have been exported

unset

Delete an environment variable

Power Users

df -k

Determine how full the partitions on the local hard disks are.

du -ks

Determine the disk usage of a given directory and all sub directories

find -name

Locate a file on the file system.

ps -ef

Get a look at the processes running on the machine

top

Take a look at the memory and CPU usage as well as the top processes on the machine

man

Get help for a given command

diff

Report the differences between two files.

gzip

Compress a file.

gunzip

Decompress a file.

tail

Look at the end of a file.

tar cf ./*

Tar all the files in this directory into a tar-ball in the lower directory

tar xvf

De-tar the contents of a tar-ball

Perl Specific

perl -w

Execute a Perl Script with warnings.

perl -c

Get compilation errors for a Perl script

perldoc ::

Get help for a Perl function in a given module.

perldoc perlfunc

Get help on basic Perl functions.

perldoc perlpod

Get help on Perl (POD = Plain Old Documentation) documentation

Java Specific

java

Run a compiled class

java -client

Run a compiled class where the JVM is optimized as a client

java -server

Run compiled class where the JVM is optimized as a server

javac

Compile a source file

Linux command websites

The first thing I learned about Linux command was actually bash script which makes life much easier. There are just simply too many commands to memorize. To have a cheat sheet posted near your desk is a great idea.

Some simple Linux commands

I am kind of person can't live without Windows. In short, I need AutoCAD almost everyday. But we only have a Windows version, and it is not cheap. When I run simulation codes, it seems to me that Linux is a better platform. So I go with dual boot.
The following are commands I use in Linux:

  • tar zcvf ***.tar.gz *** --to zip a folder or file with name ***
  • tar zxvf ***.tar.gz --to unzip a folder or file
  • ls -l --list contents
  • pwd --print directory
  • ps -aux --list processes
  • kill -9 *** --to kill a process name ***
  • sudo yum -y update --to update the whole system (I do this before I go home)
  • mv --rename or move file/folder
  • rm --remove file (to remove folder use rm -R)
  • man --this is a good friend

Some AutoCAD commands

The following are some commands I use in AutoCAD.

  • units --to setup units for your DWGs
  • layer --to organize your DWGs' layers
  • di --measure distance
  • center --center of circle
  • 3do --3D orbit for solid model watching
  • shade --solid color on 3D DWGs
  • from --starting point (when you draw a line)
  • @ --refer to the point you just selected (otherwise, CAD will refer to the origin)
  • < --drawing a line at an arbitrary angle. (When you're drawing a line at an unusual angle, you may want to see how the angle looks. After you specify the first point, you can type the < (angle) symbol and then the angle you want to try. For example, <10.
  • google is always there for the rest :-)

Saturday, March 31, 2007

I learned skating (not figure skating though.) in collage, but never enjoyed it. I must say that this couple was fantastic. It makes me think that no matter whatever you do, passion is one of the essential ingredients.

The link:
http://www.youtube.com/watch?v=Z2onmlL194M&mode=related&search

Friday, March 30, 2007

Fedora Core 6 on Latitude X200

Recently, I received a HP laptop as a gift. This little x200 thus could finally be turned into a 100% linux machine as I wished for a long time. Since it was in dual boot (WinXP and Fedora core 2) for roughly a year. I expected that the FC6 would work perfectly. Oh, well, life seems a little rougher this time.

I already installed FC6 on my other two desktops without any 'extra' problems. 'Extra' means more than expected :-) All of my desktops are 64bit, it was nature to install 64bit instead of 32bit for me. I hated my decision on this 64bit FC6. The firefox addons problem is just simply annoying. There are some ways to get around of it, but I was too tired to try them out.

Ok, my little x200 is 32bit. There shouldn't be any problem then. Yes, on flash player addon side, it was true. But wait, we were not there yet. Before we could see the pretty screen, trouble came! It wouldn't start. GRUB WOULD NOT START. I was panic at the beginning. Since this laptop is about 5 years old, I was thinking to replace the hard drive although there was nothing wrong with it. (I just experienced a hard drive failure on my desktop a month ago.) My immediate thought was there must be some bad sections on this poor old hard drive. So I did partition again, and reinstall FC6. The same problem was still there! It was thus not the poor little hard drive then. Let's work on THE PROBLEM itself, the grub. It turned out the solution was simple, just replace the grub with a working one. Reboot the machine, runs smoothly thereafter. It would save me some time if I worked directly on the problem.

As Confucius said, Life is really simple, but men insist on making it complicated.

Thursday, March 29, 2007

Kahana valley trial


It is a muddy trail, but is definitely worthy a try.

Loud is its sound, but never word it said.

Scholars of the highest class, when they hear about the Tao, earnestly carry it into practice.
Scholars of the middle class, when they have heard about it, seem now to keep it and now to lose it.
Scholars of the lowest class, when they have heard about it, laugh greatly at it.
If it were not (thus) laughed at, it would not be fit to be the Tao.

Therefore the sentence-makers have thus expressed themselves:--

'The Tao, when brightest seen, seems light to lack;
Who progress in it makes, seems drawing back;
Its even way is like a rugged track.
Its highest virtue from the vale doth rise;
Its greatest beauty seems to offend the eyes;
And he has most whose lot the least supplies.
Its firmest virtue seems but poor and low;
Its solid truth seems change to undergo;
Its largest square doth yet no corner show
A vessel great, it is the slowest made;
Loud is its sound, but never word it said;
A semblance great, the shadow of a shade.'

The Tao is hidden, and has no name; but it is the Tao which is skillful at imparting (to all things what they need) and making them complete.

chmod, chown

I was trying to change a group of folders' owner the other day. It took me a few minutes to realize that 'chmod' was not for this purpose. The right command is 'chown' :-) I should use Linux more frequently.