顯示具有 Linux command 標籤的文章。 顯示所有文章
顯示具有 Linux command 標籤的文章。 顯示所有文章

2008年3月26日 星期三

查 distribution 版本

/etc下面通常會有一個 xxxx-release, xxxx 就是 distribution 的名字

2008年3月14日 星期五

chown

change directory or file的權限:

ex: sudo chown -R root AppleRAID.kext
AppleRAID.kext的user變成root
-R表示從AppleRAID開始,以下的hierarchy也跟著改變。

2008年3月12日 星期三

lsscsi

lists information about SCSI devices in Linux.

ex:
[0:0:8:0] disk FUJITSU MAM3184MP 0105 /dev/sda
scsi_host,channel,target_number,lun tuple for [0:0:8:0]

2008年3月4日 星期二

alias

自訂command
ex: alias cp='cp -i'
輸入cp即等於cp -i

2008年2月26日 星期二

netstat

show network status

-r:
Show the routing tables

-a:
顯示在本地機器上的外部連接

-p:
Show the PID and name of the program to which each socket belongs.

wget

get file from http or ftp
ex: wget http://www.open-iscsi.org/bits/open-iscsi-2.0-865.15.tar.gz

2008年2月25日 星期一

yast

suse上的software management

2008年1月31日 星期四

svn

co:
co = checkout,將程式donwload下來
svn co http://SVN_PATH/svn_project

svn import . svn://192.168.1.200/projects/tickets --message "initial import" –username eldon
將程式存放到repository

svn checkout svn://192.168.1.200/projects/tickets tickets
將repository上的程式download下來

svn remove log/*
svn commit --message "removing all log files from subversion"
移除repository上log/下的files

svn propset svn:ignore "*.log" log/
svn commit –message "Ignore all log files in the log directory"
除止log下的files上傳到repository

2008年1月29日 星期二

killall

killall -9 test
終止所有叫test的process

sudo

sudo -s
輸入自己的密碼,獲得root權限

s: The -s (shell) option runs the shell specified by the SHELL envi-ronment environment
ronment variable if it is set or the shell as specified in
passwd

2008年1月23日 星期三

ping6

測試IPv6是否可正常使用
ping6 ::1


用local-addresses 作為ping6 目標必需指定一個界面. 否則核心將不知道數據包發往哪個設備
ping6 -I lo0 fe80:0:0:0:0:0:0:1

lsof

lsof (lists open files)

Show all connections with -i
lsof -i

Show only TCP (works the same for UDP)
lsof -iTCP

Show IPv6 connection
lsof -i 6

2008年1月20日 星期日

cut

print selected columns or fields
-d
set field delimiter

-f
print field

ex:
KERNEL = $(uname -r)
VERSION=$(echo $KERNEL | cut -dE -f1)
echo $VERSION

output: 2.6.9-42.ELsmp
explain: 以E分隔2.6.9-42.ELsmp,f1= 2.6.9-42. f2= Lsmp

2008年1月18日 星期五

關機

shutdown -h now

2008年1月17日 星期四

文字模式

[Ctrl] + [Alt] + [F1] ~ [F6] :文字介面登入 tty1 ~ tty6 終端機

0 - halt (系統直接關機)
1 - single user mode (單人維護模式,用在系統出問題時的維護)
2 - Multi-user, without NFS (類似底下的 runlevel 3,但無 NFS 服務)
3 - Full multi-user mode (完整的含有網路功能的純文字模式)
4 - unused (系統保留功能)
5 - X11 (與 runlevel 3 類似,但使用 X Window)
6 - reboot (重新開機)

修改/etc/inittab
開機預設的 run level 設定項目
id:3:initdefault:

2008年1月16日 星期三

grep

search string in files

-n: show line number

ex: grep abc Desktop/*
search abc in files under directory Desktop

find

(1) find file
ex: find Headers/ -name ipc_types.h
recursive find ipc_types.h from Headers directory

(2) show content of directory
find directory_name

find

(1) find file
ex: find Headers/ -name ipc_types.h
recursive find ipc_types.h from Headers directory

(2) show content of directory
find directory_name

2008年1月7日 星期一

vim

G: go to last line

vimrc的修改( in /usr/share/vim under mac)
顏色:
syntax on

show line number:
set number

ps

process monitoring

ex: ps -aux
-a: show processes that are owned by other users & attatched to a terminal
-u: user format
-x: include processes without controlling terminals( such as daemon process)