2009年5月6日

Linux Shell 下的輸出重定向

Linux Shell 環境中支持輸入輸出重定向,用符號<和>來表示。0、1和2分別表示標準輸入、標準輸出和標準錯誤信息輸出。同時,還可以在這三個標準輸入輸出之間實現重定向,比如將錯誤信息重定向到標準輸出,可以用 2>&1來實現。Linux下還有一個特殊的文件/dev/null,它就像一個無底洞,所有重定向到它的信息都會消失得無影無蹤。如果想要正常輸出和錯誤信息都不顯示,則要把標準輸出和標準錯誤都重定向到/dev/null, 例如:
# ls >/dev/null 2>&1
注意:此處的順序不能更改,否則達不到想要的效果,此時先將標準輸出重定向到 /dev/null,然後將標準錯誤重定向到標準輸出,由於標準輸出已經重定向到了/dev/null,因此標準錯誤也會重定向到/dev/null,於是一切靜悄悄.

Reference
http://blog.daviesliu.net/2005/08/31/200811/

2008年11月12日

[Linux] Install Vmware-tools on Fedora Core 8

Step 1. Install gcc
#yum install gcc

Step 2. Install kernel-devel
#yum install kernel-devel

Step 3. Check if the version number of kernel and the version number of kernel-devel are the same
#uname -r
#rpm -q kernel-devel

Step 4. Upgrade kernel and kernel-devel if their version number showed in in Step 3. are different
#yum -y upgrade kernel kernel-devel
Go to Step 3.

Step 5. Reboot
#init 6

Step 6. Put vmware-tools in running FC8
Removable Devices > CD-ROM > Edit -->
Select Auto detect and check Legacy emulation
VM > Install VMware Tools Install

Step 7. Install vmware-tools
#mount /dev/cdrom /mnt
#cp /mnt/VMwareTools-*.tar.gz /tmp
#cd /tmp
#tar -zxvf VMwareTools-*.tar.gz
#cd vmware-tools-distrib
#./cd vmware-install.pl
...


Reference
http://163.23.24.147/ya/read-287.html
http://hi.baidu.com/sinauc/blog/item/2d393754243636c2b745ae24.html

2008年11月6日

[Linux] Samba on Fedora Core 8

Step 0. Samba Package
samba
samba-client
samba-common


Step 1.
Install Samba
#yum install samba


Step 2.
Configuration
#vi /etc/samba/smb.conf

I. Security Level: Anonymous access
# ==== Global Settings =======
security = share
# ==== Share Definitions =====
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes


II. Security Level: User authentication
# ==== Global Settings =======
security = user
passdb backend = tdbsam
# ==== Share Definitions =====
[homes]
comment = Home Directories
browseable = yes
writable = yes
;valid users = %S
;valid users = MYDOMAIN\%S


Step 3. Parse smb.conf setting in Step 2.
#testparm

Step 4. New a Samba User
(Samba user must be a existing acount)
#useradd SambaUserName
#pdbedit -a SambaUserName

Step 4. Restart Samba Service
#/etc/rc.d/init.d/smb restart

Reference
http://www.mtm.ks.edu.tw/computer/FC5/#samba
http://blog.yam.com/iq180/article/13382018
http://b2d.phc.edu.tw/modules/tadbook2/view.php?book_sn=12&bdsn=697
http://phorum.study-area.org/index.php?action=printpage;topic=53332.0

2008年10月14日

[Linux] Hostname

Step 1.
#hostname NewHostname

Step 2.
#vi /etc/sysconfig/network
HOSTNAME=NewHostname

Step 3.
#vi /etc/hosts
add a new line in the following format
IP NewHostname

2008年10月6日

[Other] Game

http://www.rocksolidarcade.com/games/dogfight2/