w
, top
, uptime
, and procinfo
commands or access the /proc/loadavg
file to view the load.
Please refer to "Installing Software in the Linux Environment" for instructions on how to install the procinfo tool. vmstat
, iostat
, and top
commands to identify the reason for the high load and optimize the processes. free
, top
(after running, you can press shift+m
to sort the memory), vmstat
, and procinfo
commands or by accessing the /proc/meminfo
file. top -p PID
, pmap -x PID
, and ps aux|grep PID
commands or by accessing the /proc/$process_id (process PID) /status
file (for example, the /proc/7159/status
file). netstat -tunlp
, netstat -antup
, and lsof -i:PORT
commands. ps auxww|grep PID
, ps -ef
, lsof -p PID
, and top -p PID
commands. kill -9 PID
(PID indicates the process ID) and killall program name
(for example, killall cron) to stop a process.
To stop a zombie process, you need to kill the parent process by running kill -9 ppid
(ppid indicates the parent process ID, which can be queried by running ps -o ppid PID
(for example, ps -o ppid 32535)). top
to view the total of zombie processes, and run ps -ef | grep defunct | grep -v grep
to locate a specific zombie process. root
user can enable ports below 1024 on the Linux operating system. Run sudo su -
to obtain root permissions before enabling the server port.
For application issues such as port conflicts or configuration problems, use the application startup logs to troubleshoot them. The Tencent server system uses port 36000. Command Name | Description |
top | top is a task manager program that monitors the overall performance of the system. This command can be used to display information such as the system load, the process, the CPU, the memory, and paging. Use shift+m and shift+p to sort the processes by memory usage and CPU usage. |
vmstat | vmstat is a computer system monitoring tool mainly used for virtual memory that collects and displays summary information about CPU, processes, memory paging, and IO. For example, vmstat 3 10 outputs results every 3 seconds and is executed 10 times. |
iostat | iostat is a computer system monitoring tool that collects and displays statistics about CPU and IO. For example, iostat -dxmt 10 outputs detailed information about IO in MB every 10 seconds. |
df | df is a command used to display the amount of available disk space. For example: df -m displays the disk space usage in MB. |
lsof | lsof reports a list of all open files, which is very useful for Linux system management. For example: lsof -i: 36000 displays the processes using port 36000. lsof -u root displays the programs run by root. lsof -c php-fpm displays the files opened by the php-fpm process. lsof php.ini displays the processes for which php.ini is opened. |
ps | ps is a process query command that displays information related to the processes. Commonly used command parameter combinations are `ps -ef` and `ps aux`. Use `ps -A -o` to output custom fields. For example: `ps -A -o pid,stat,uname,%cpu,%mem,rss,args,lstart,etime |sort -k6,6 -rn` outputs results according to the listed fields and sorts them using the 6th field. `ps -A -o comm |sort -k1 |uniq -c|sort -k1 -rn|head` lists the process with the largest number of running instances. |
free -m
, du
, uptime
, w
, /proc/stat
, /proc/cpuinfo
, and /proc/meminfo
. crontab -e
to add the following test item.\\*/1 \\* \\* \\* \\* /bin/date >> /tmp/crontest 2>&1 &
/tmp/crontest
file.
If there are any problems, run ps aux|grep cron
to look for the pid of cron, run kill -9 PID
to terminate the cron process, and then run /etc/init.d/cron start
to restart cron. /etc/cron.deny
.\\*/1 \\* \\* \\* \\* /bin/date >> /tmp/crontest 2>&1 &
./sbin/init
process./etc/rc.d/rc\\*.d
, where the value of * means the running mode, which can be queried in /etc/inittab
./etc/rc.d/rc.local
./etc/rc.d/rc.local
or in the S\\*\\*rclocal
file in /etc/rc.d/rc\\*.d
. df -m
to check the disk usage and then delete unnecessary files to free disk space. (We do not recommend you delete non-third party files. Please check the files before you delete them). df -i
to view and confirm relevant processes. /var/log
./var/log/messages
.df
to query the disk partition usage (for example, df -m
).du
to query the size of a specific folder (for example, du -sh ./\\*
, du -h --max-depth=1|head -10
).ls
to list the files and file sizes (for example, ls -lSh
).
You can also directly check the size of files under a specific directory by using the find
command (for example, find / -type f -size +10M -exec ls -lrt {} \\
).export
to check the user environment variables such as LANG and LC_CTYPE.rm
, you may find that the available disk space does not increase when you use df
to check the disk space. This is because when the file is deleted, if another process happens to be accessing the file, the space occupied by the deleted file will not be immediately freed at the time you check the disk space.lsof |grep deleted
using the root permission and find the PID of the process that is using the deleted file.kill -9 PID
.rm
to delete files. Files deleted with this command cannot be recovered. Therefore, please use this command with caution.
Format of rm
: rm (option) (parameter)
.-r
or -R
option.rm test.txt
to delete the test.txt
file.rm -r test
to delete the test
directory.rm -r *
to delete all files and sub-directories under the current directory.
Was this page helpful?