Lab 11.4.6: Checking Resource Usage in Linux Estimated Time: 20 Minutes Objective In this exercise, the student will learn how to check the resources on a Linux system.. This lab cover
Trang 1Lab 11.4.6: Checking Resource Usage in Linux
Estimated Time: 20 Minutes
Objective
In this exercise, the student will learn how to check the resources on a Linux system This lab covers the following commands:
• df
• du
• top
Equipment
The following equipment is required for this exercise:
• A computer running Linux Red Hat 7.2 or greater
Scenario
There is a server running Linux that has been running efficiently for a long time but the system resources might be reaching their limits The technician decides decide to run a few of the commands to check the system resources to ensure that the system will continue run properly
Procedures
There are three basic Linux commands used to check and record the resource usage on
a Linux system
Step 1: The df Command (disk file system)
1 Login as the root user If in the GUI interface, open a terminal window
2 To use the man df command, type:
man df
3 In the space below give a brief description of the df command
Trang 2
4 What does the –h switch do?
5 To determine the amount of hard drive space that is being used by Linux, type:
df
To make the output of the df command easier to read, type:
df -h
Record the results in the table below
[root@systemA1 boot]# df -h
Filesyem Size Used Avail Use% Mounted on
/dev/hda2 1.9G 827M 1.0G 45% /
/dev/hda1 30M 2.7M 26M 10% /boot
[root@systemA1 boot]#
Example of the df command
Step 2: The du Command (disk usage)
1 Remain logged in as the root user; Use the man command to learn about the du
command From a terminal window type:
man du
2 In the space below, give a brief description of the du command
Trang 35 Go to a student home page, and type:
cd /home studentA5
Note: studentA5 is used as an example only Use the student account that the
instructor has assigned
6 From within the studentA5 home directory, type:
du
Next type:
du –hs
What is the difference in the commands when the –hs switches are added? How much space is being used in studentA5’s home directory?
7 The du command can useful in determining the size of any directory or file within a
directory To go to the /etc directory and determine the size of the directory and the size of the passwd file, type the following command sequence:
cd /etc
du
du –hs
du –hs passwd
What is the size of the /etc directory?
What is the size of the passwd file?
Trang 4
Example of the du command
Step 3: The top Command
1 Use the man command to learn about the top command From a terminal window
type:
man top
2 In the space below, give a brief description of the top command
3 From a terminal type:
Trang 54 In the space below, write in information determined from the top output:
CPU idle time in %
Number of users
Number of processes
Number of processes sleeping
Amount of memory used
Amount of memory free
Example of the top command
Trang 6Troubleshooting
Network administrators use the top command to determine system processes If one application is using too many system resources, it may be a runaway application How can the application process id (pid) be identified?
Reflection
Monitoring system resources is an issue that network administrators must respond to daily Develop a plan to track the resources of the Linux system(s) Could this plan be automated? If so, how?