[LINUX] A command to check when something goes wrong when the server is not doing anything

A command to check when you don't know enough to say that the server isn't doing anything.

Check disk capacity

Commands such as file creation fail when disk usage is Max or close. You can check the disk usage with df -h.

$ df -h
Filesystem      Size   Used  Avail Capacity iused      ifree %iused  Mounted on
/dev/disk1s6   233Gi   10Gi  139Gi     7%  484247 2447617073    0%   /
/dev/disk1s1   233Gi   79Gi  139Gi    37% 1215180 2446886140    0%   /System/Volumes/Data

If Avail is close to 100%, it is better to delete the large file under the file written in Mounted on. What exactly is squeezing capacity in Mounted on? Is confirmed with du -sh. If you want to see under /, you can check how much is used for each directory under / with du -sh / *. Depending on the authority, you may not be able to see some of them, so it is recommended to use sudo with root authority.

$ du -sh ./*
 26M	./Desktop
1.5M	./Documents
1.4G	./Downloads

Since it was late to do it with / *, it is done with ./* in the example.

Check CPU usage and load

If you have a heavy load process, CPU usage or Load Avg should be high. Use the top command for confirmation. If the load is high, check the process with the ps command. If you can identify the process with a high load, kill the process with the kill command or restart the target service with the systemctl command.

At the end

You can understand something from the above two points, so if you can't think about it at all, you may want to try it for the time being. If you still don't understand, check the log or read from the error.

If you haven't done anything wrong, the above command alone should tell you something. ..

Recommended Posts

A command to check when something goes wrong when the server is not doing anything
How to check when python-memcached server could not be connected
Check when the Docker container does not connect to the Internet
[AWS] What to do when the ping command causes a "timeout"
[Blender] Script to check if the selected one is a mesh
A note on how to check the connection to the license server port
A command to easily check the speed of the network on the console
What to do when "Something is already running at port 8000" is displayed when the develop command of Gatsby is executed.
The first thing to check when a No Reverse Match occurs in Django
[AWS] Wordpress How to deal with "The response is not a correct JSON response"
I want to be notified when the command operation is completed on linux!
It's a Mac. What is the Linux command Linux?
Create a command to get the work log
Create a python script to check if the link at the specified URL is valid 2
What to do when is not in the sudoers file.This incident will be reported.
It is better to use NTFS when connecting SSD to Linux to create a file server.
Create a python script to check if the link at the specified URL is valid
Send a push message to the LINE Bot when the LTE-M Button is pressed [SORACOM]
How to check in Python if one of the elements of a list is in another list
There is a pattern that the program did not stop when using Python threading
I made a command to wait for Django to start until the DB is ready
Check if the string is a number in python
When the selected object in bpy.context.selected_objects is not returned
How to write a GUI using the maya command
python> check NoneType or not> if a == None:> if a is None:
Check when the version does not switch with pyenv
I made a command to markdown the table clipboard
Creating a list when the nomenclature is a fixed time
[Golang] Command to check the supported GOOS and GOARCH in a list (Check the supported platforms of the build)
How to create a new file when the specified file does not exist — write if the file exists
What to do when a Missing artifact occurs in a jar that is not defined in pom.xml
A story that pyenv is stuck because the python execution command PATH does not pass
When a character string of a certain series is in the Key of the dictionary, the character string is converted to the Value of the dictionary.
A Python script that allows you to check the status of the server from your browser
What I was addicted to in Collective Intelligence Chaprter 3. It's not a typo, so I think something is wrong with my code.