Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Last month's "Tech Support" showed how to monitor resource utilization with Cacti. This month, let's use vmstat to track down any bottlenecks that Cacti might have found. Part of the procps package (which contains many other useful utilities such as ps, top, w, and kill), vmstat reports statistical information about process status, memory consumption, paging activity, block I/O operations, interrupts, context switches, and processor usage. vmstat is available from http://procps.sourceforge.net and is licensed under the GPL. While you can download and install the latest version of procps, it's a standard set of utilities found in almost every Linux install.
A nice feature of vmstat is its overview of process, memory, swap, I/O, system, and CPU activity in just one line of numbers. Figure One shows a sample of vmstat output.
Figure One: Sample output of vmstat
procs memory swap io system cpu
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 104232 218884 3364308 0 0 0 1 1 1 4 1 0 1
Briefly, r and b are the number of processes waiting for run time and the number of processes in uninterruptible sleep, respectively. swpd, free, buff, and cache display how much virtual memory is being used (kB), the amount of idle memory (kB), the amount of memory used as buffers (kB), and the amount of memory used as a page cache, in that order. si shows the amount of memory swapped in from disk (kB/s), while so conveys the amount of memory swapped to disk (kB/s). bi and bo reflect the blocks sent to and from a block device (in blocks per second), respectively. in measures the number of interrupts per second, including the clock. cs shows the number of context switches per second. Finally, us, sy, id, and wa display the percentage of total processor time consumed by user-space, the kernel, spent idle, and spent in I/O wait, respectively.
vmstat can be invoked in a few different ways. Typing vmstat with no parameters yields a single line of output containing averages (calculated from the time the system was last booted). Given an optional delay, such as vmstat 5, vmstat prints a line with averages as above, and then prints a new line every 5 seconds until interrupted. Each line after the first represents the values for that time period. Lastly, you can specify a delay and a count value, as in vmstat 5 10, to print a report every 5 seconds terminating after 10 lines. Five seconds seems to be a good delay, as the output is based on a reasonable amount of data.
Fully interpreting vmstat output requires an in-depth understanding of Linux or Unix architecture, but you'll quickly find it useful with a couple of tips and a little testing.
For example, if the r column is consistently higher than the number of CPUs in the machine, you are most likely CPU-bound and would benefit from more or faster processors. You can find out what's eating your CPU time using a tool such as top. With similar reasoning, you can deduce whether your bottleneck is caused by memory or I/O and then use an appropriate tool to narrow down the problem or upgrade your hardware. Don't forget that, regardless of how much memory you have, the free column eventually dwindles. This is normal and is a result of your memory being used for I/O cache and buffers -- it is not necessarily indicative of a memory shortage.
Installing True Type Fonts
If you own a new flat-panel display, but your web pages and documents just don't "look right," perhaps you need to install True Type fonts. Many web pages and documents use True Type fonts, but by default, Linux doesn't have any installed. Luckily, Xfree86 4.0 and above supports True Type fonts. (If you're using an older version of X you can either upgrade, or install a font server such as xfsft.)
The first thing to do is find a copy of each of the fonts that you'd like to install. The easiest way to do this is to copy them from a Windows machine or from a CD-ROM. Some True Type fonts can even be downloaded from the Internet.
Once you've found some fonts, choose where to install them, such as /usr/share/fonts/truetype/. Then copy all of the .ttf files into the directory and run the following commands as root:
# cd /usr/share/fonts/truetype
# ttmkfdir > fonts.scale
# chkfontpath -a /usr/share/fonts/truetype
Now, the True Type fonts in that directory are available to your applications.
The instructions above should work for most distros. Some distributions include configuration tools or tricks to make font installs even easier. Regardless of how you install them, True Type is sure to greatly improve your Linux experience. Enjoy.