Tải bản đầy đủ (.pdf) (6 trang)

Tài liệu Checking Resource Usage in Linux pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (46.19 KB, 6 trang )

1 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.
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 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.
__________________________________________________________________
2 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.
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
Filesystem Size Used Avail Use% Mounted on




[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
none 62M 0 61M 0% /dev/shm
[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.
__________________________________________________________________
3. What does the –h switch do?
__________________________________________________________________
4. What does the –s switch do?
__________________________________________________________________
3 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.

5. 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?
__________________________________________________________________

4 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.

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:
top
5 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.
4. 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
6 - 6 IT Essentials II v2.0 - Lab 11.4.6 Copyright  2002, Cisco Systems, Inc.
Troubleshooting
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?
__________________________________________________________________
__________________________________________________________________


×