compress/uncompress :.Z
gzip/gunzip .gz
bzip2/bunzip2 .bz2
xz/unxz .xz
zip/unzip 还可以归档
tar,cpio
gzip
-# 数字 1-9压缩比
-c 标准输出
-d 解压缩 =gunzip
zcat不显示展开的前提下查看文本文件内容
-k 保留原文件
tar -cf .tar file 创建
-tf 查看
-xf 展开
-zcf gzip
-jcf bz2
-Jcf xz
shell
列表生成方法 {start..end}
$(seq [start[step]] end)
$@ $* 变量引用
netstat -tan
#!/bin/bash
declare -i estab=0
declare -i listen=0
declare -i other=0
for state in $(netstat -tan | grep "^tcp\>" |awk 'print $NF' );do
if [ "state" == 'ESTABLISHED' ];then
let estab++
elif [ "state" == 'LISTEN' ];then
let listen++
else
let other++
fi
done
echo "ESTABLISHED:$estab"
echo "LISTEN:$listen"
echo "unknown:$other"