We earn commission when you buy through affiliate links.
This does not influence our reviews or recommendations.Learn more.
In this article, I will talk about the Linux commands often used by middleware administrators or Sysadmin daily.
Tips:if you have multiple file systems, then it may take time to search.
So best would be to replace / with the actual file system where you think the log would be.
Lets say you believe log is in /opt file system, so you’re able to do this.
For Example:
Note:Above example shows nginx with PID20924is holding443port.
who -bCommand will give you the exact date and time of the server reboot.
Alternatively, you may also useuptimeto check how long the server is up.
This will help you determine which process takes high CPU/Memory in real-time.
Tip:look for the CPU/Memory section for the first few PID to find out the utilization.
Alternatively, you may also use thefreecommand to find out total and free memory.
Another command called SAR (System Activity Report) is also very helpful in finding CPU and memory stats.
To check the CPU utilization
To check the Memory utilization
5.
Kill the process
Occasionally, the process doesnt stop gracefully if its hung or defunct.
In this scenario, it’s possible for you to kill the process manually.
If the above doesnt help, you’re free to forcefully use -9 to kill the process.
Note:PID is your process ID
6. gzipcommand can be used to compress the files.
gunzip command will help you to extract the gz file.
Here is a quick command to help you find the CPU, memory, and file system details.
So you’re able to use grep to filter out the required information.
This will show you total, free & cached memory
Second one…
This will show you much more information along with total memory.
Includinghwill give you output in GB which is easy to understand.
This is an extremely useful handy command if you are looking for this information.
Tip:you might use a with ifconfig to show all available Ethernet details.
Tip:above you could see HTTP response code is 200 means there is no issue in connectivity.
Verify if the server can connect to backend service with the particular port number.
This is very useful for aconnectivity test.
In the below example, I have checked if geekflare.com on 443 port can be reached or not.
If you see Connected then that confirms there is nothing wrong with connectivity/firewall.
Below example is to show the data pipe path from my server to geekflare.com
10.
Well, not to worry its part of learning.
Here is the quick way to change the ownership or permission.
Tip: The above will change ownership of error.log to the mentioned user and group.
Ex:-
11. uname
Useunamecommand with the-aflag to print system information.
Here is what it means
12. du
To check disk space usage in a directory, useducommand.
For example, to see disk space usage in the /var/log directory.
Use-hflag for human-readable format.
To see only the total usage only use-s(summary) flag.
13. ps
Usepsto display status information about processes running on the system.
It is used as follows :
To suppress verbose output, use+shortflag.