Skip to content

服务器命令

🔴 查看负载情况

  • htophighlight top】动态查看服务器负载情况

🔴 查看操作系统版本信息 :cat /etc/os-release

输出文件

  • tail -n 200 -f order-erp_out.log 实时输出文件后 200 行

网络资源

🔴 查看 ip

  • curl ifconfig.me 查看公网 ip
  • hostname -I 查看内网 ip

🔴 lsof List Open Files 列出当前系统中所有被进程打开的文件

  • -i internet 所有网络连接
  • -i TCP 只看 TCP
  • -i :端口号 指定端口号的进程

🔴 配置代理 —— 进入 .zshrc 文件,填写以下内容。后续开启代理就输入命令 pon,关闭代理就输入 poff

pon() {
  export http_proxy="http://127.0.0.1:7890"
  export https_proxy="http://127.0.0.1:7890"
  export all_proxy="socks5://127.0.0.1:7890"
  echo "🟢 代理已开启"
}

poff() {
  unset http_proxy https_proxy all_proxy
  echo "🔴 代理已关闭"
}

磁盘资源

  • df -h --total 「disk filesystem」查看本机磁盘占用情况

进程

  • pgrep -af download_pmc_v4.py 查看该文件是否在运行(有输出 = 在运行)

用户权限

  • su pengziqi 切换用户

娱乐命令

动物说话

bash
## 更新软件包
sudo apt update
sudo apt install -y cowsay

cowsay hello shiyanlou

## 打印所有支持的动物
cowsay -l

## 使用'-f'选择动物种类
cowsay -f elephant hello shiyanlou

calvin cheese daemon elephant eyes ghostbusters sheep

简易浏览器

bash
sudo apt-get install w3m

## 在linux下打开百度官网
w3m https://www.baidu.com