dstat is a tool that is used to retrieve information or statistics form components of the system such as network connections, IO devices, or CPU, etc. It is generally used by system administrators to retrieve a handful of information about the above-mentioned components of the system. It itself performs like vmstat, netstat, iostat, etc. By using this tool one can even see the throughput for block devices that make up a single filesystem or storage system.
Installation of dstat command
On RedHat based OS
yum install dstat
On ubuntu or debian
sudo apt install dstat
Working with dstat Command
1. To display statistics of major OS components
This command will display CPU, Disk, Network, Paging and System stats.
2. To display information that was to be displayed by vmstat tool
The above command results in the process and memory stats.
3. To display stats of process using most of the CPU.
dstat -c --top-cpu
This will display the stats of the process which is consuming most of the CPU.
4. To display stats of process using most of the memory.
dstat -d --top-mem
This will display the stats of the process which is consuming most of the memory.
5. To display the list of all plugins
Plugins are the options you want to display the stats of. The above command will list all such plugins.
6. To force float values to be printed
This will force the float values to be printed which were hidden earlier.
7. To force bits values to be printed.
This will print all the values in bits that were earlier used to be printed in bytes.
8. To display the output without colors
This command will now display the outputs in white color only.
9. To get all stats of the processes.
This command will display all the stats of the processes.
10. To display help
This will display the help section of the dstat command.