How To use top, netstat, du, & other Tools to Monitor server resources

Using Top Netstat Du & Other Tools to Monitor Server Resources

As a server administrator, it’s crucial to monitor server resources regularly to ensure that everything is running smoothly. In this article, we’ll cover some of the essential tools that you can use to monitor server resources.

Top

Top is a command-line tool that provides real-time information about the system’s processes, including CPU usage, memory usage, and system load. To use top, open your terminal and type:

$ top

You can use the following keys to interact with top:

  • q: Quit top.
  • k: Kill a process.
  • r: Renice a process.
  • H: Toggle thread view.
  • z: Toggle color/monochrome.
webhi monitor top server

Netstat

Netstat is a command-line tool that displays network connections, routing tables, and network interface statistics. To use netstat, open your terminal and type:

$ netstat -a

This command will show all the network connections that are active on your system.

You can use the following keys to interact with netstat:

  • a: Show all sockets.
  • n: Don’t resolve names.
  • p: Show the PID and name of the program to which each socket belongs.
  • r: Show the routing tables.
  • s: Show statistics.
webhi monitor netstat server

Du

Du is a command-line tool that displays disk usage statistics for a file or directory. To use du, open your terminal and type:

$ du -h /path/to/directory

This command will display the disk usage of the specified directory in a human-readable format.

You can use the following keys to interact with du:

  • -h: Display sizes in a human-readable format.
  • -s: Display only a total for each argument.
  • -c: Display a grand total for all arguments.
webhi monitor du server

Htop

Htop is an interactive process viewer and system monitor that provides a more user-friendly interface than top. To use htop, open your terminal and type:

$ htop

You can use the following keys to interact with htop:

  • F1: Help.
  • F2: Setup.
  • F3: Search.
  • F4: Filter.
  • F5: Tree view.
  • F6: Sort by.
  • F7: Nice – increase process priority.
  • F8: Nice – decrease process priority.
  • F9: Kill process.
  • F10: Quit.
webhi monitor htop server

Iostat

Iostat is a command-line tool that displays CPU utilization and I/O statistics. To use iostat, open your terminal and type:

$ iostat

You can use the following keys to interact with iostat:

  • -c: Show only CPU utilization.
  • -d: Show only disk I/O statistics.
  • -k: Show output in kilobytes.
  • -m: Show output in megabytes.
webhi monitor iostat server

Net-tools

Net-tools is a collection of command-line tools that provides information about network connections and interfaces. To use net-tools, open your terminal and type:

$ ifconfig

This command will show information about all network interfaces on your system.

You can use the following keys to interact with net-tools:

  • ifconfig: Show information about network interfaces.
  • route: Show routing table.
  • arp: Show the ARP cache.
webhi monitor ifconfig server

Nethogs

If your network connection seems overutilized and you are unsure which application is the culprit, a program called nethogs is a good choice for finding out.

Nethogs is a command-line tool that provides real-time network bandwidth monitoring.

On Ubuntu, you can install nethogs with the following command:

$ sudo apt install nethogs

To use nethogs, open your terminal and type:

$ sudo nethogs

This command will show the network bandwidth usage of each process on your system.

You can use the following keys to interact with nethogs:

  • q: Quit nethogs.
  • s: sort by SENT traffic
  • r: sort by RECEIVE traffic
  • m: switch between total (KB, B, MB) and KB/s mode
webhi monitor nethogs server

Iptraf-ng

Iptraf-ng is a command-line tool that provides real-time network statistics for each network interface on your system.

you can install iptraf-ng with the following command:

$ sudo apt install iptraf-ng

To use iptraf-ng, open your terminal and type:

$ sudo iptraf-ng

This command will show real-time statistics for each network interface.

You can use the following keys to interact with iptraf-ng:

  • q: Quit iptraf-ng.
  • s: Display statistics for selected interface.
  • n: Display statistics for next interface.
  • r: Refresh display.
  • d: Display detailed statistics.
  • u: Display UDP statistics.
  • t: Display TCP statistics.
webhi monitor iptraf-ng server

Conclusion

These are just a few of the many tools available to monitor server resources. By regularly monitoring server resources, you can ensure that your server is running smoothly and efficiently.

LEAVE A COMMENT