1.列出所有目录使用量,并按大小排序。 ls|xargs du -h|sort -rn #不递归下级目录使用du -sh 2.查看文件排除以#开关和空白行,适合查看配置文件。 egrep -v "^#|^$
1.列出所有目录使用量,并按大小排序。
ls|xargs du -h|sort -rn
#不递归下级目录使用du -sh
egrep -v "^#|^$" filename
sed '/#.*$/d; /^ *$/d'
sed '/^$/d' filename #删除空行
sed 's/ //g' filename
sed 's/[[:space:]]//g' filename
sed -i 's/#.*$//g' filename
pkill -KILL -t pts/0
find / -type f -size 0 -exec rm -rf {} ;
pgrep Nginx|xargs kill
pidof nginx|xargs kill
ifconfig |awk -F"[ ]+|[:]" 'NR==2 {print $4}'
utmpdump /var/log/wtmp
ps aux --sort=rss |sort -k 6 -rn
python -m Simplehttpserver
echo "passWord" |passwd ?stdin root
ssh-keygen -y -f ~/.ssh/id_rsa && cat ~/.ssh/id_rsa.pub | ssh root@host "cat - >> ~/.ssh/authorized_keys"
mkcd ( ){
mkdir $1
cd $1
}
tar zcvf - back/ | ssh root@www.lsjlt.com tar xzf - -C /root/back/
wget -r -p -np -k Http://www.lsjlt.com
#r递归 p下载所有文件 np不下载上级 k转换相对链接
pstree -ap 10277|grep -oP '[0-9]{4,6}'|xargs kill -9
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
awk -F "|" '{if($NF!="") print $NF}'
awk -F '' '{if(NF>6) print $0}'
lynx -dump www.lsjlt.com #包含页面的URL
w3m -no-cookie -dump www.lsjlt.com
links -dump www.lsjlt.com #对中文内容支持不好
socat tcp4-LISTEN:1234,reuseaddr,fork, TCP4:www.baidu.com:80
sed 'p;s/^.*$/--------/' file
awk '{print $0;print "-------"}' file
sed 's/^/new/g' file
sed 's/$/new/g' file
awk -F "" '{for(i=1;i<=NF;i++) print $i}'
ls | xargs rm
--结束END--
本文标题: 25个好用的Shell脚本常用命令分享
本文链接: https://www.lsjlt.com/news/17898.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-05-11
2024-05-11
2024-05-10
2024-05-07
2024-04-30
2024-04-30
2024-04-30
2024-04-29
2024-04-29
2024-04-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0