tshark抓包
sudo tshark -s 512 -i eth0 -n -f 'tcp dst port 80' -R 'http.host and http.request.uri' -T fields -e http.host -e http.request.uri -l | tr -d '\t'
查看CPU的型号
cat /proc/cpuinfo | grep name | cut -f2 -d: |uniq -c
查看CPU 几核几线程
grep 'processor' /proc/cpuinfo |sort -u |wc -l
grep 'core id' /proc/cpuinfo |sort -u |wc -l
以人性化的展示文件大小
du -h file
文本按照列进行合并
paste -d" " file1 file2 >> newFile
查看端口被哪个进程占用 以80端口为例:
sudo lsof -i: 80
端口扫描:
nmap ip
删除txt文本中的第一列的命令:
sed -i -r -e "s/^[[:space:]]+//" -e "s/^[^[:space:]]+[[:space:]]+//" *.txt
把log.txt中的前600行追加到log1.txt中去
sed -n '1,600 p' log.txt > log1.txt
查看文件的编码:
enca -L zh filename.java
解压/压缩 命令:
后缀为gz:
解压:gzip -d FileName.gz
压缩:gzip FileName
后缀为.tar.gz
解压:tar zxvf FileName.tar.gz
压缩:tar zcvf FileName.tar.gz
压缩为zip
zip -r myfile.zip myfile/*
后缀为.bz2
解压:bzip2 -d fleName.bz2
压缩: bzip2 -z fileName
后缀为.rar
解压:rar a FileName.rar
压缩:r ar e FileName.rar
后缀为.tgz
解压:tar zxvf FileName.tgz
linux 查看外网ip
curl ifconfig.me
curl http://members.3322.org/dyndns/getip
在控制台打开某个文件窗口
nautilus /home/***
输出某一列
cat ××.txt |awk '{print $1}' >> out.txt
循环读取文件夹中的文件并保存为新的文件
for file in *
do
if test -f $file
then
#echo $file is file!
cat $file |awk '{print $2}' >'N'$file
else
echo $file is mulu!
fi
done
windows文件拷贝到linux乱码时 指定编码
iconv -f GBK -t UTF-8 file1 -o file2
批量转码shell
#!/bin/sh
for i in *
do
iconv -f gb2312 -t utf-8 $i >tmp
cp tmp $i
done
文本去空格
sed s/[[:space:]]//g
文本文件内容洗牌
cat in.txt | awk 'BEGIN{srand()}{print rand()"\t"$0}' | sort -k1,1 -n | cut -f2- > out.txt
去引号
sed 's/"//g'
tr -d '"'
awk -F ',' '{print $14,$15}' cup14w15w >> newcup
tr -d \" < file
cut -d\" -f2 file
cat tag3 | awk '{if($0 ~ /ag/) print " "; else print "C"$0+1 }' >> tag5
~ /ag/ 模糊匹配
参考 >http://linuxtools-rst.readthedocs.io/zh_CN/latest/base/index.html
http://man.linuxde.net/tee