- Nikhil Bhaskar
- May 16, 2021
How To Use Some Monitor Server Resources such as top, htop Part:1
Introduction:
To perform computer system for proper administration and monitoring.
How to monitor system Processes.
top
One of the most common tools to check the resource utilization of processes is “top“.
Command:
top
Output:
The top portion has some system statistics, including load averages for last 1 minute, 5 minutes, and 15 minutes. It also shows memory and swap usage and count of various process states.
The bottom portion has every process on the system and organized by the top users of resources. This list is updated in real-time.
htop
Although “top” is included in almost every distribution by default and an improved version of top which called “htop” is available for download from most repositories. It will show the real-time live processes running and working.
To install htop on Ubuntu, type the following:
Command:
sudo apt-get install htop
Command:
htop
Output:
Here are some keys that will help to use htop more effectively:
- M: Sort processes by memory usage
- P: Sort processes by processor usage
- ?: Access help
- k: Kill current/tagged process
- F2: Setup htop. You can choose display options here.
- /: Search processes
How Do I Find Out How Much Disk Space I Have Left?
df
For a quick overview of how much disk space have left in drives we can use “df” command.
Command:
df
Output:
If we want to see the total disk space available on all file systems, we can pass the “–total” option. This will add a row at the bottom with summary information:
If want see the output of the disk fragmentation in a human readable so you can use the command.
Command:
df -h
Output:
How to find the space of the memory and its usage.
free
The easiest way of finding out the current memory usage on your system with “free” command.
When used without options the output looks like below:
Command:
free
Output:
If need to see the output in human readable then use -h parameter.
Command:
free -h
output:
To display in a more readable format we can pass the “-m” option to display the output in megabytes:
Command:
free -m
Output:
Conclusion
Using these tools we will be able to monitor server from the command line. There are many other utilities that perform simple monitoring operations.