![]() |
|
| Daemon News Ezine | BSD News | BSD Mall | BSD Support Forum | BSD Advocacy | BSD Updates |
Gathering System InformationBy Chris Coleman chrisc@vmunix.comIf you manage multiple BSD computers, you have noticed that one command line looks very much like any other command line. It is easy to get turned around and think you are working on one computer, when you are really working on another. This is especially true if you use the same or similar passwords on multiple systems. I know several BSD admins that have rebooted the wrong computer because they forgot which computer they were logged into. They all look the same when you are logged in remotely. BSD provides several utilities to display information about the computer you are working on. hostname will display the name of the computer you are logged into. myname# hostname This helps if all you need to know is the name of the computer to verify that you are working on the right one. However, this isn't always enough. The next level of information about your system can be gathered from the uname utility. According to the man page: The uname command writes the name of the operating system implementation to standard output. When options are specified, strings representing one or more system characteristics are written to standard output. If you just type uname it will tell you which operating system it is. To get any really useful information from uname, we need to use the -a option. I have listed below the uname -a output from FreeBSD, OpenBSD, and NetBSD. I tried to grab one from different architectures as well as different BSDs. I don't actually have all these machines, so I grabbed these off the mailing list archives. myname# uname -a Each one of them starts out by printing the operating system type, followed by the computer name. Then it gives the OS version. The # following the OS version is the number of times the running kernel has been recompiled without modification to the kernel configuration file. Basically, the system was upgraded or changed and they used the same kernel config file. The architecture of the computer is also listed, along with the name of the Kernel config file that was used. When you are asking other people for help, especially on a mailing list, they will want to know the output of uname -a. Yet, there will often be times when this is still not enough information about your system. dmesg is a utility that will display the information that appeared during boot up. This includes the processor speed, amount of RAM memory, and all the device drivers that loaded.
OpenBSD 2.1 (TWP) #3: Sat Jul 19 18:37:43 CDT 1997
twp@twp.tezcat.com:/usr/src/sys/arch/i386/compile/TWP
CPU: Pentium (GenuineIntel 586-class CPU) 133 MHz
BIOS mem = 654336 conventional, 32505856 extended
real mem = 33157120
avail mem = 29097984
using 430 buffers containing 1761280 bytes of memory
mainbus0 (root)
isa0 at mainbus0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
lpt0 at isa0 port 0x378-0x37f irq 7
isadma0 at isa0
aic0 at isa0 port 0x340-0x35f irq 11
scsibus0 at aic0: 8 targets
probe(aic0:3:0): sync, offset 8, period 100nsec
sd0 at scsibus0 targ 3 lun 0:
This dmesg output provides a lot of very helpful information. The downside to this is that is isn't apparent to the new user what it all means. The first section of it describes the operating system, CPU type and physical RAM memory. Try to get Windows to tell you that with out rebooting. :-) The rest of the dmesg output is a list of devices drivers and how they loaded. I'll list a few of the basic devices:
aic0 is the SCSI controller.
sd0 is the first SCSI disk drive.
wd0 is the first IDE disk drive.
cd0 is a SCSI CD Drive.
wdc0 is an IDE controller.
fdc0 is the floppy disk controller.
spkr0 is the internal speaker.
fd0 is the floppy disk drive.
These will differ a bit on each BSD and they tend to change a little over time. This is an older dmesg, but it does the job. There is still some information that we might need. The filesystem has not been addressed yet. We still need to be able to tell how much disk space we have available and how our filesystem is arranged. The command df displays the filesystem layout and how much of it is used. According to the man page: Df displays statistics about the amount of free disk space on the speci- fied filesystem or on the filesystem of which file is a part.
chris# df Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/wd0s1a 31743 27686 1518 95% / /dev/wd0s1f 1359855 1078917 172150 86% /usr /dev/wd0s1e 31743 5779 23425 20% /var procfs 4 4 0 100% /proc Each disk or partition on disk is listed. The "Mounted on" listing shows which directory device is attached to. For example we have 172 Meg available in the /usr/ directory and only 23 Meg available in the /var/ directory. This should be enough information to keep you informed about your computer. For further information read the man pages for dmesg, df, and uname. |