linux基础命令练习1
# ls -l | grep "^d" ??
# cat /etc/ssh/sshd_config | grep -v? ^#
[^xx] ?不包括xx
# ls -Fl? | grep /$
# grep? ?-Ev "^#|^$"? ?/etc/ssh/sshd_config
# egrep? ?-v "^#|^$"? ?/etc/ssh/sshd_config?
# find? . -type d ! -name "."
# find? . -type d ! -name "."? -prune
# tree -Ld? 1
# ls -l | sed -n /^d/p
ls -l | awk '/^d/'
# ls -lF | sed -n '/\/$/p'
#find ? -o ? ?-and ? !
^$空行
\
# cd -
當(dāng)一個(gè)命令的輸出,含有我們需要的內(nèi)容的時(shí)候,我們要想到這個(gè)命令可能會(huì)有對(duì)應(yīng)的參數(shù)直接顯示,我們需要的內(nèi)容。
# ll -lrt /etc/ ? 最近時(shí)間的文件 ? ? ? ? ? ?(照著更新時(shí)間,反著排練文件)
# grep hequan? --color=auto? ?1.txt
# source /etc/profile ?別名生效
#ln ?硬鏈接 ? ? ?-s 軟連接 ? ? ? ? ?目錄 ? ? ? ? ?新的目錄
# find ./? -type f -name "*.log"? -mtime? +7? | xargs rm -f
for n in `seq 100`; do sleep 1 ; echo $n >> /var/log/messages ;done?
# cat -n ? ? ? ? #more ? #less ? ?:set nu :set ?nonu ?
# runlevel
more ?less?
# ls /etc/rc.d/rc3.d/ | grep sshd
# grep -Ev "^#|^$"? /etc/inittab
# vi /etc/sysconfig/i18n?
echo ? ?source ? ? export
# tar zcvf? /tmp/etc.tar.gz? /etc/ ? 打包 ? ? ? 筐 ?蘋果?
# tar tf etc.tar.gz ?看
# tar vxf ? hequan.tar.gz ? -C ?/tmp/ 解包
?#tar zcfv? hequan.tar.gz? ? ?--exclude=/etc/ssh? ?/etc/ ? ? ? ?不包括
# tar zcvfX? ?hequan.tar.gz? ?a.txt /etc/
?# tar jcvf? hequan.tar.bz? /etc/
# tar jxvf? hequan.tar.bz
-N增量打包
# awk '{print $3 " " $6}'? hequan.txt
# cut -c 6-12,21- hequan.txt
# sed s#,##g? hequan.txt | awk? '{print $3" " $6}'
??
cut ?-d ?切割 ? -f數(shù)據(jù)選列, ? ?-c按字符切割
# wc -l hequan.txt
# cat -n /etc/services? | tail -l?
# sed -n '$='? /etc/services
# awk? '{print NR }'? /etc/services? ?| tail -l
# ps -ef?
# ps -ef | grep sshd
# ps -ef | grep sshd | wc -l
# ps -ef |grep -v grep | grep sshd?
轉(zhuǎn)載于:https://blog.51cto.com/hequan/1758200
總結(jié)
以上是生活随笔為你收集整理的linux基础命令练习1的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 用jamon来监控你的sql执行效率
- 下一篇: 操作系统:内核功能