補充兩點
echo 反顯命令
可以用來創建文件
echo aaa>a.txt
echo bbb>>a.txt追加
users 查看在線用戶
比who看到的信息少,但是同時刻用戶數一樣
統計當前在線用戶數
openlab.tarena.ca% users
xiaoyao lujl xiaoyao tanjh
openlab.tarena.ca% users|wc -w
4
等價于
openlab.tarena.ca% who|wc -l
4
===========================================================
find / -name file
find . -mtime 10 -print 修改時間距現在正好10天
find /etc -user 0 -size +400 -print /etc目錄下 user為0,也就是root為owner的文件,并大小大于400的文件
注意兩個條件為與關系,并且大于400,是data block。
1data block = 512bytes 也就是 400 data block = 200K
find ~ -perm 777 > ~/holes
權限為777的
find /export/home -type f atime +365 -exec rm {} \;
注意后面,-exec空格rm空格{}空格\; 一個都不能少,才可執行刪除,刪除目錄-exec rm -r {} \;
可以用于刪除文件名為rm某參數的不可刪除文件
例如
echo aaa>-i 為形成-i的文件
openlab.tarena.ca% rm -i
usage: rm [-fiRr] file ...
那么就需要這樣來刪除
find . -name '-i' -exec rm {} \;
grep -i 不區分大小寫
grep -v 過濾不匹配后面的串
ls -l|grep ^d
那么就是列出該目錄中的子目錄
ls -l|grep -v ^d
列出文件了,因為是-v
與li -l|grep ^-等價
grep file *
到每個文件中尋找"file"串
more file*
可以同時查看多個file1,file2,file3。。。的內容。
diff file1 file2
openlab.tarena.ca% echo aaa>file1
openlab.tarena.ca% echo bbb>file2
openlab.tarena.ca% diff file1 file2
1c1
< aaa
---
> bbb
提示說明,將第一個文件的第一行修改成為bbb
openlab.tarena.ca% more file*
::::::::::::::
file1
::::::::::::::
aaa
ccc
::::::::::::::
file2
::::::::::::::
bbb
openlab.tarena.ca% diff file1 file2
1,2c1
< aaa
< ccc
---
> bbb
提示,第一、二兩行都變成bbb
openlab.tarena.ca% more file*
::::::::::::::
file1
::::::::::::::
aaa
ccc
::::::::::::::
file2
::::::::::::::
aaa
ccc
zzz
openlab.tarena.ca% diff file1 file2
2a3
> zzz
在第一個文件的第二行后,加入第二個文件的第三行的內容
openlab.tarena.ca% more file*
::::::::::::::
file1
::::::::::::::
aaa
ccc
::::::::::::::
file2
::::::::::::::
aaa
ccc
zzz
openlab.tarena.ca% diff file1 file2
2a3,5
>
>
> zzz
第一個文件第二行,加入第二個文件中的3到5行內容。
openlab.tarena.ca% diff file1 file2
6d5
< xxx
----------------------------------------
openlab.tarena.ca% more file1 file2
::::::::::::::
file1
::::::::::::::
aaa
ccc
zzz
xxx
::::::::::::::
file2
::::::::::::::
aaa
ccc
zzz
openlab.tarena.ca% diff file1 file2
5,6d4
<
< xxx
注意是將第一個文件的5到6行刪除,到第二個文件的第四行。
--------------------------------------------------------------------------
ps -ef
e所有進程 f詳細列表方式
PID 進程號
PPID 父進程號
任何進程最后都能追蹤到inetd
sh -> csh -> in.telnetd -> inet -> init(1) -> sched(0)
ps -ef|grep inetd|grep -v grep|wc -l
ps -ef|more 有各列表頭
STIME進程開始時間
TTY 終端 Console
?表示與終端脫離關系的進程,應該是daemon
TIME 累計占用時間
CMD進程名稱
/usr/ucb/ps -auwx|more
ps的另外一個實現版本
進程有幾種狀態,運行,就緒,掛起,僵尸進程。
<default>,由于父進程出現問題,當子進程已經沒有了,告訴父,但是父沒有消除它,這樣造成任在進程表中保留一項,累計多后,對系統造成影響。
上述情況,由程序員造成。解決,殺死父進程。
kill -9 12487
-9表示無條件殺死
pkill sleep
不需要進程號
-------------------------------------
sleep 100 前臺運行,不釋放終端控制
sleep 100& 后臺運行
jobs -l 列任務
bg 任務號
fg 任務號
stop 進程號 掛起后臺進程
Control -z掛起前臺進程。
Control -c放棄前臺進程。
------------------------------------------
ls file*|xargs grep file
分解輸入
grep file file1 file2
查內容了,不等同于ls file*|grep file,將結果給grep,而是分解file*為file1 file2再給grep
--------------------------------------------
/etc/hosts
ip與主機名的對應表
/etc/netmasks
/etc/defaultrouter
默認網關
/etc/hostname.hme0
主機名稱
/etc/resolv.conf
DNS
/etc/nodename
網卡對應的名稱,一臺機器有可能有多個網卡,而主機名只有一個,與/etc/hostname.hme0不同。
ping 127.0.0.1(loop back地址),是檢查邏輯地址有效否?也就是檢查TCP/IP是否安裝好?
netstat -rn 查看硬件
rusers -l tarenalab3
遠程看lab3上的在線用戶。
traceroute www.sina.com.cn
finger user1@tarenalab1
telnet
rlogin hostname -l lujl
----------------------
ftp hostname
lcd 顯示本地目錄,和設置本地目錄
hash 打#每1024
prompt交互信息開關
mget mput
mdelete
rename 可以移動文件!!!!!!!
wall 廣播 Ctrl + D
write
talk
mesg -y|-n
posted on 2005-11-16 22:47
北國狼人的BloG 閱讀(321)
評論(0) 編輯 收藏 所屬分類:
達內學習總結