3 Basic Commands and Simple Shell Scripts Once you have your first Red Hat Enterprise Linux rhel


# dfFilesystem 1K-blocks Used Available Use Mounted



Download 1.85 Mb.
View original pdf
Page46/67
Date26.02.2024
Size1.85 Mb.
#63678
1   ...   42   43   44   45   46   47   48   49   ...   67
Pablo Iranzo Gómez, Pedro Ibáñez Requena, Miguel Pérez Colino, Scott McCarty - Red Hat Enterprise Linux 9 Administration-Packt Publishing (2022) -chap 3 82 - 180
# df
Filesystem 1K-blocks Used Available Use Mounted
on
devtmpfs 442628 0 442628 0% /dev
tmpfs 489100 0 489100 0% /dev/
shm
tmpfs 195640 5380 190260 3% /run
/dev/mapper/rhel-root 40935908 18334816 22601092 45% /
/dev/sda2 1038336 565624 472712 55% /boot
/dev/sda1 102182 7704 94478 8% /boot/
efi
By using this, it’s easy to focus on filesystems with higher utilization and less free space to prevent issues.
Important Note
If a file is being written, such as by a process logging its output, removing the file will just unlink the file from the filesystem, but since the process still has the file handle open, the space is not reclaimed until the process is stopped. In case of critical situations where disk space must be made available as soon as possible, it’s better to empty the file via a redirect, such as echo ""
> filename. This will recover the disk space immediately while the process is still running. Doing this with therm command will require the process to be finalized.
We’ll checkout CPU usage next.

Tools for Regular Operations
124
CPU
When it comes to monitoring the CPU, we can make use of several tools, such asps. You can see this in use here:
Figure 4.7 – Output of the ps aux command (every process in the system)
The ps command is the de facto standard for checking which process is running, as well as resource consumption usage.
As for any other command, we could write a lot about all the different command arguments we could use (so, again, check the man page for details, but as a rule, try to learn about their basic usage or the ones that are more useful for you. For anything else, check the manual. For example, ps aux provides enough information for normal usage (every process in the system).
The top tool, as shown in the following screenshot, refreshes the screen regularly and can sort the output of running processes, such as CPU usage, memory usage, and more. In addition, top also shows a five-line summary of memory usage, load average, running processes, and so on:

Checking for free resources – memory and disk (free and df Figure 4.8 – top execution on our test system
CPU usage is not the only thing that may keep our system sluggish. Now, let’s learn a bit about load average indicators.
Load average
Load average is usually provided as a group of three numbers, such as load average 0.81,
1.00, 1.17, which is the average that’s calculated for 1, 5, and 15 minutes, respectively. This indicates how busy a system is the higher it is, the worse it will respond. The values that are compared for each time frame give us an idea of whether the system load is increasing (higher values in 1 or 5 and lower on 15) or if it is going down (higher at 15 minutes, lower at 5 and 1), so it becomes a quick way to find out if something happened or if it is ongoing. If a system usually has a high load average over 1.00 per CPU, it would be a good idea to dig a bit deeper into the possible causes (too much demand for its power, not many resources available, and so on).
Now that we have covered the basics, let’s move on and look at some extra checks we can perform on our system resources usage.

Tools for Regular Operations
126

Download 1.85 Mb.

Share with your friends:
1   ...   42   43   44   45   46   47   48   49   ...   67




The database is protected by copyright ©ininet.org 2024
send message

    Main page