Home
Username:
Password:
Unix System Administration Essentials Tutorials

Getting Around in Unix / Getting System Information

Subtitles of the Movie

In this next session we're going to look at the basics of getting some system information from a running BSD Unix system. Now, some of these things are very simple things that you might want to get routinely as a system administrator. Some of these things include running processes on the system, information about system services, some configuration information and a look at the startup logs to see what kind of happened during startup if you have issues. This is by no means all of the information you can gather and by no means all the methods that you can use to gather this information. I'm just going to show you a few key things that you can do from the Command Line of course to get some key system information. In no particular order, some of the things we might want to look at on the system include running processes, memory and CPU usage, disk usage and also system services and startup messages. So let's take a quick look at each one of these areas and see how we can get valuable system information. Let's look at processes first. The basic process command is the PS command and this is used throughout Unix and Linux and basically you can use it to get a list of the running processes on the system right now and there are many different switches you can use with PS. You can get information per user on the entire system and so forth. Another command that we can use basically is TOP and TOP gives you system processes and basically it gives you CPU usage and so forth and it gives you those on a running basis. You can see the different system processes and so forth as they're happening and how they're taking up system resources. This is continually updated as need be and we can end TOP by hitting Control C. The next thing we'll look at is memory usage. One way that we can look at memory usage is through the VMstat command and we can make it so it gives us a constantly-updated view of system memory usage, uh, maybe every three seconds for example and so every three seconds or so we'll get a different view of system memory usage and this will keep on going as long as you like for it to. Now, you would use this during performance monitoring or system monitoring and we're going to be talking about that a little bit more in depth as we go through the course so we'll cover this a little bit more later. Another command you can use to monitor CPU usage is IOstat and IOstat pretty much works the same way as VMstat does but it gives you CPU usage and it could be constantly updated as well. Let's say again, every three seconds. So it gives us CPU usage and again, you would use this while performing system monitoring if there was an issue with system bottleneck or system performance and so forth. The next thing we'll take a look at is system services. Now, there are many different ways to look at system services or daemons as they're called in the Unix world and one way we can actually look and see what's started up is to cat a certain file called the etc RC.conf file and while this is not the only configuration file used for system services, this can tell you what's currently started on the system and right now we don't have a lot started. We could just have very basic services such as DHCP and SSHD enabled. There are many other different ways you can look at running daemons on the system as well. Now, one thing you can do also is look at system messages. One command that we've already looked at is the D Message command and what this does for us is it gives us a look at the system kernel startup messages. In other words, when the system booted up, this was all the kernel messages that came up. Let's do this a little bit differently. Let's pipe this to the Less command so we can see it, see all of it and these are the messages that came up when the kernel was booting so if there's any issues with boot or startup or kernel issues, we can go back and look at the D Message command and get this information to help troubleshoot it. And as you can see, there's a lot of information there. So we filter it through this. Something else we can do is we can actually look at the Fire Log Messages files and we can also cat that if we wanted to. Let's pipe this, let's put this through less though. Let's say var/log/messages and see what we get. We're going to get a lot of messages here and basically this is system messages, kernel messages and so forth and this will help us troubleshoot again problems with hardware, problems with performance, the kernel, drivers and so forth. There's a lot of information here and while we won't go through it right now, we will spend some time on system performance and monitoring and we will cover some of those things. As you can see, there's a lot of information there. Yet another command we can run to monitor disk usage and so forth is the Mount command and the Mount command is going to show us what different file systems are currently mounted. Right now we have the ADO S1A mounted on Root. If we want to, we can look and see the /etc/fstab file and this will tell us all the devices and their mount points. For example, we have the hard drive partition AD0S1A mounted on Slash, which is the root directory and the CD-ROM is mounted on ACD0. So when we look at these, this can help us start troubleshooting or start looking at file systems because we know what's in the FSTab file and we know what's mountable. Now, if we want to, we can look at disk usage statistics and file system statistics. One command we can use to look at disk usage is the DU command and it's basically going to give us some information depending upon what switches we use with it. There's a lot of different switches for the DU by the way. Now, if we look at the DF command, that's file system usage and we can see the number of blocks that's used, availability, capacity and so forth and right now we've got 19 percent capacity in use mounted on slash and DevFS is mounted on /dev so we've got some interesting information here. Again, this is very basic and if you actually use some switches with this, you could probably get a lot more information that might help you solve a particular problem with disk usage. These are just a few of the ways that we've talked about to get system information from your BSD Unix System to take a look at what's going on under the hood of BSD Unix and then keep in mind there are many other different ways and methods you can use to actually quite a bit of other information as well and we'll cover some of those, again, as we go through the course where appropriate.

Tutorial Information

Course: Unix System Administration Essentials
Author: Bobby Rogers
SKU: 34153
ISBN: 1-936334-45-3
Release Date: 2010-08-12
Duration: 4.5 hrs / 57 lessons
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available