• Linux可复用命令行


    查当前目录空间占用

    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;
    
  • 相关阅读:
    Reverse Integer
    First Bad Version
    Heaters
    Number of Segments in a String
    RPI学习--环境搭建_串口连接
    关键字const
    main函数参数的使用
    Redis 简单使用 and 连接池(python)
    南宁AI项目
    Go part 1 初探
  • 原文地址:https://www.cnblogs.com/jrri/p/15168003.html
Copyright © 2020-2023  润新知