# 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 -
当一个命令的输出,含有我们需要的内容的时候,我们要想到这个命令可能会有对应的参数直接显示,我们需要的内容。
# ll -lrt /etc/ 最近时间的文件 (照着更新时间,反着排练文件)
# 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数据选列, -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
原文地址:http://hequan.blog.51cto.com/5701886/1758200