[ Pobierz całość w formacie PDF ]
.Displaying system space with dfYou can display the space available in your file systems using the df command.To see the space available onall of the mounted file systems on your Linux computer, type df with no options:$ dfFilesystem 1k-blocks Used Available Use% Mounted on/dev/hda3 30645460 2958356 26130408 11% //dev/hda2 46668 8340 35919 19% /boot/dev/fd0 1412 13 1327 1%/mnt/floppyThe output here shows the space available on the hard disk partition mounted on the root partition (/dev/hda1),/boot partition (/dev/hda2), and the floppy disk mounted on the /mnt/floppy directory (/dev/fd0).Disk space isshown in 1K blocks.To produce output in a more human-readable form, use the -h option as follows:$ df -hFilesystem Size Used Avail Use% Mounted on/dev/hda3 29G 2.9G 24G 11% //dev/hda2 46M 8.2M 25M 19% /boot/dev/fd0 1.4M 13k 1.2M 1% /mnt/floppyWith the df -h option, output appears in a friendlier megabyte or gigabyte listing.Other options with df letyou:"Print only file systems of a particular type (-t type)"Exclude file systems of a particular type (-x type)"Include file systems that have no space, such as /proc and /dev/pts (-a)"List only available and used inodes (-i)"Display disk space in certain block sizes (--block-size=#)Checking disk usage with duTo find out how much space is being consumed by a particular directory (and its subdirectories), you can usethe du command.With no options, du lists all directories below the current directory, along with the space consumed by each directory.At the end, du produces total disk space used within that directory structure.The du command is a good way to check how much space is being used by a particular user (du /home/user1)or in a particular file system partition (du /var).By default, disk space is displayed in 1K block sizes.To makethe output more friendly (in kilobytes, megabytes, and gigabytes), use the -h option as follows:$ du -h /home/jake114k /home/jake/httpd/stuff234k /home/jake/httpd137k /home/jake/uucp/data701k /home/jake/uucp1.0M /home/jakeThe output shows the disk space used in each directory under the home directory of the user name jake(/home/jake).Disk space consumed is shown in kilobytes (k) and megabytes (M).The total space consumedby /home/jake is shown on the last line.Finding disk consumption with findThe find command is a great way to find file consumption of your hard disk using a variety of criteria.Youcan get a good idea of where disk space can be recovered by finding files that are over a certain size or werecreated by a particular person.Note You need to be root user to run this command effectively.In the following example, the find command searches the root file system (/) for any files owned by the usernamed jake (-user jake) and prints the filenames.The output of the find command is then listed with a longlisting in size order (ls -ldS).Finally that output is sent to the file /tmp/jake.When you read the file /tmp/jake,you will find all of the files that are owned by the user jake, listed in size order.Here is the command line:# find / -user jake -print -xdev | xargs ls -ldS > /tmp/jakeTip The -xdev option prevents file systems other than the selected file system from being searched.This is agood way to cut out a lot of junk that may be output from the /proc file system.It could also keep largeremotely mounted file systems from being searched.The next example is similar to the previous one, except that instead of looking for a user s files, this commandline looks for files that are larger than 100 kilobytes (-size 100k).Here is the command line:# find / -size 100k -print -xdev | xargs ls -ldS > /tmp/sizeYou can often save yourself a lot of disk space by just removing some of the largest files that are no longerneeded.Open the /tmp/size file in this example and large files are sorted by size.Monitoring System PerformanceIf your Linux system is being used as a multiuser computer, sharing the processing power of that computercan be a major issue.Likewise, any time you can stop a runaway process or reduce the overhead of anunnecessary program running, your Linux server can do a better job serving files, Web pages, or e-mail to thepeople that rely on it.Utilities are included with Linux that can help you monitor the performance of your Linux system.The kindsof features you want to monitor in Linux include CPU usage, memory usage (RAM and swap space), andoverall load on the system.The following sections describe tools for monitoring Linux. Checking system load average with xloadOne way of keeping an eye on general system performance is to open an xload window on your desktop andput it off in the corner somewhere.The xload window graphically represents the performance of your system.It periodically checks the load on the system and then charts demand on the system over time.By default, xload updates the display every 10 seconds.Scale lines on the window help you monitor whenxload has exceeded certain limits.The label in the xload window shows the system name.By running xloadwindows from various host computers and displaying them on your screen, you can monitor a whole set ofcomputers at once.Figure 10-6 shows the xload window [ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • necian.htw.pl