查当前目录空间占用
du -h --max-depth=1
查IP地址
ifconfig $(route -n |grep ^0.0.0.0|awk '{print $8}')|grep -E "inets+"|awk '{print $2}'|sed -r "s#.*:([0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}).*#1#g"
查Linux版本号
cat /etc/redhat-release |sed -r "s#.*release ([0-9].[0-9]).?[0-9]{0,5}.*#1#g"
调Python解析json
cat ./demo.json |python -c "import json,sys; obj=json.load(sys.stdin); print(''.join(i['value'] + ' ' for i in obj['menu']['popup']['menuitem'] if i['value']));"
查Java进程端口
echo;if [[ ! $(whoami) == "root" ]]; then echo "[WARNING] Please use root";fi;echo;echo "==========";oldifs="$IFS";IFS=$'
';for i in $(ps -ef|grep -v grep|grep java);do echo -n -e "PID : ";echo $i|awk '{print $2}';echo -n -e "NAME: ";echo $i|sed -r "s#.* (.*.jar).*#1#g";echo -n -e "PORT: ";echo $(ss -ntlp|grep $(echo $i|awk '{print $2}') |sed -r "s#.*::.*:([0-9]{3,5}).*#1#g");done;IFS=$oldifs;echo "==========";echo;