常用 linux 命令
常用 Linux 命令
后台无输出运行:
nohup command > /dev/null 2>&1 &
查看 CPU 数量
# 物理 CPU
cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l
# 单个 CPU 核数
cat /proc/cpuinfo| grep "cpu cores"| uniq
# 逻辑 CPU
cat /proc/cpuinfo | grep 'processor' | wc -l
查看 CPU 占用
# 每隔 10 秒查看一次 CPU 占用情况
sar -P ALL 10
screen
# 新建会话
screen -S name
# 查看已有会话
screen -ls
# 连接名为 name 的会话,不存在则创建
screen -R name
# 连接处于 detached 状态的会话
screen -r name
# 连接处于 attache 状态的会话 (-D 踢掉其他连接,-r 重连)
screen -D -r name
# 删除会话
screen -S name -X quit