Process Management
Some useful commands that can be used to monitor the processes on Linux systems.
ps (process status)
The ps command is used to know the information of a process or list of processes.
If you get an error "ps command not found" while running ps command, do install procps package.
ps without any arguments is not very useful. Let's try to list all the processes on the system by using the below command.
Reference: https://unix.stackexchange.com/questions/106847/what-does-aux-mean-in-ps-aux
We can use an additional argument with ps command to list the information about the process with a specific process ID.
We can use grep in combination with ps command to list only specific processes.
top
The top command is used to show information about Linux processes running on the system in real time. It also shows a summary of the system information.
For each process, top lists down the process ID, owner, priority, state, cpu utilization, memory utilization and much more information. It also lists down the memory utilization and cpu utilization of the system as a whole along with system uptime and cpu load average. Memory Management
In this section, we will study about some useful commands that can be used to view information about the system memory.
free
The free command is used to display the memory usage of the system. The command displays the total free and used space available in the RAM along with space occupied by the caches/buffers.
free command by default shows the memory usage in kilobytes. We can use an additional argument to get the data in human-readable format.
Checking Disk Space
In this section, we will study about some useful commands that can be used to view disk space on Linux.
df (disk free)
The df command is used to display the free and available space for each mounted file system.
du (disk usage)
The du command is used to display disk usage of files and directories on the system.
The below command can be used to display the top 5 largest directories in the root directory.
Systemd
Systemd is a system and service manager for Linux operating systems. Systemd units are the building blocks of systemd. These units are represented by unit configuration files.
The below examples shows the unit configuration files available at /usr/lib/systemd/system which are distributed by installed RPM packages. We are more interested in the configuration file that ends with service as these are service units.
Managing System Services
Service units end with .service file extension. Systemctl command can be used to start/stop/restart the services managed by systemd.
Command | Description |
---|---|
systemctl start name.service | Starts a service |
systemctl stop name.service | Stops a service |
systemctl restart name.service | Restarts a service |
systemctl status name.service | Check the status of a service |
systemctl reload name.service | Reload the configuration of a service |
Logs
In this section, we will talk about some important files and directories which can be very useful for viewing system logs and applications logs in Linux. These logs can be very useful when you are troubleshooting on the system.
Last updated