Linux运维常用命令组合
lsof -i:port
根据监听端口号找进程PID
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 14374 root 12u IPv6 376449654 0t0 TCP *:8957 (LISTEN)
lsof |grep deleted
如果一个文件正在被一个运行中的进程读取,此时删除次文件,此文件空间不会被释放,使用du -sh无法统计此文件占用的空间;可以通过此命令查看已经被删除过仍然占用空间的文件清单,然后通过kill进程释放文件占用空间
Determine which MySQL configuration file is being used
$ which mysqld
/usr/sbin/mysqld
$ /usr/sbin/mysqld --verbose --help | grep -A 1 "Default options"
Default options are read from the following files in the given order:
/etc/mysql/my.cnf ~/.my.cnf /usr/etc/my.cnf
test nginx configuration
nginx -t
docker command
lsns -t net|pid
ls -la /proc/{pid}/ns