其中```ps```的参数```a```代表“所有进程(all with tty, including other users)”,```u```代表“user(user-oriented format)”,```x```代表“显示所有进程(processes without controlling ttys)”
那么```ps aux```就显示了所有进程的资源占用信息:
```bash [Tisfy@LetMeFly ~]# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 10.00.32507886128 ? Ss 202210:08 /usr/lib/systemd/systemd --switched-root--system--d root 20.00.000 ? S 20220:02 [kthreadd] root 30.00.000 ? I< 20220:00 [rcu_gp] root 40.00.000 ? I< 20220:00 [rcu_par_gp] root 60.00.000 ? I< 20220:00 [kworker/0:0H-kblockd] (以下省略)
head
-1```就是显示第一行的内容,也就是
1
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
```sort```命令用于排序,```-r```是“从大到小排序(reverse the result of comparisons)”默认从小到大,```-n```是“根据数值排序(compare according to string numerical value)”,```-k```是“以第几列为依据进行排序(sort via a key; KEYDEF gives location and type)”(下标从1开始,没有-k0)
## How to do
我修改了Mysql的配置文件(文件路径:```/etc/my.conf```)
可以修改或在下方添加这些参数。参数的具体意义可以在网上搜索
```yml # # This group is read both both by the client and the server # use it for options that affect everything # [client-server]
# # include all files from the config directory # !includedir /etc/my.cnf.d