[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ A ] [ B ] [ C ] [ D ] [ next ]


User's Guide (Obsolete Documentation) (Obsolete Documentation)
Chapter 10 - Reading System Information


Linux is built by users who have a hands-on approach to computing. As a result, your system includes many command line tools for displaying information.

You can view information about:

You can gather information by:

Graphical tools have been made for some of the command line tools, but they are generally less complete and flexible than the command line tools.


10.1 Reading System Information From the Desktop

Debian installs with three basic desktop information tools:

In addition, the Applets menu includes several useful monitors that display graphs of how the system is being used. In particular, laptop users might want to install the battery charge applet on the panel.


10.1.1 Using System Information from the Desktop: Using the System Info Tool

The System Info tool is the graphical equivalent of the uname -a and w commands.


10.1.2 Viewing Process Information from the Desktop: Using the gtop Command


10.1.3 Viewing User Information from the Desktop: Using the gw Command

img/Sysinfo-6.png

The gw utility is the desktop equivalent of the w command. It displays informations about users.

If you are logged in as root user, gw displays information about all users currently logged in. If you are logged in as a regular user, then only information about the current account displays.

Type gw from a command line. The Active User screen opens.

[Note]

If you use the command regularly, add it to the workspace, panel, or menu.

From the Active User screen, you can read such information about where users logged in from (local or remote), how long they have been logged in, and the processes they are currently running.


10.1.4 Using the Monitor Applets

The Applets are small programs that are a standard part of the gnome desktop. When selected, an applet displays in the panel.

The Monitor manuals are among the most useful applets. Each gives a graphic display of some aspect of the system. To add one to the panel, go to Applets > Monitors on the main menu.


10.1.4.1 Monitor Applets

     +-------------------------------------------------------------------+
     |  Monitor   |                    What It Shows                     |
     |------------+------------------------------------------------------|
     |cpu/mem     |The cpu, memory, and swap load.                       |
     |usage       |                                                      |
     |------------+------------------------------------------------------|
     |Battery     |The battery charge for laptops. Warns when the charge |
     |charge      |is low.                                               |
     |------------+------------------------------------------------------|
     |Disk usage  |The amount of hard drive space used and free.         |
     |------------+------------------------------------------------------|
     |cpu load    |The cpu resources being used.                         |
     |------------+------------------------------------------------------|
     |Memload     |The amount of memory being used.                      |
     |------------+------------------------------------------------------|
     |Swapload    |The amount of swapping done by the system.            |
     |------------+------------------------------------------------------|
     |Netload     |The load on different network interfaces.             |
     |------------+------------------------------------------------------|
     |Load Average|The average amount of activity on the system.         |
     +-------------------------------------------------------------------+

10.2 Using Command Line Tools

Linux includes many commands for gathering information. The following table summarizes some of the more common and more useful ones.

To read a complete list of options for each command, see its man or texinfo pages. See Finding Help for Commands, Section 5.6.

The following tables are divided into four categories:


10.2.1 Commands for Reading System Information

         +---------------------------------------------------------------+
         |   Command   |Information|              Comments               |
         |-------------+-----------+-------------------------------------|
         |             |           |i586 is a Pentium, i686 a Pentium II.|
         |             |           |                                     |
         |arch         |cpu        |Compatible processors, such as       |
         |             |           |Celerons, are listed as the Intel    |
         |             |           |processor to which they are          |
         |             |           |compatible.                          |
         |-------------+-----------+-------------------------------------|
         |             |           |  * The date command gives the system|
         |             |           |    date, It can also be used to     |
         |             |           |    reset the date.                  |
         |             |           |  * The cal command displays a       |
         |  * date     |Date       |    calendar for the month and year  |
         |  * cal mm yy|           |    given.                           |
         |             |           |                                     |
         |             |           |    If no month or year is given then|
         |             |           |    the calendar for the current     |
         |             |           |    month displays.                  |
         |-------------+-----------+-------------------------------------|
         |dnsdomainname|Domain name|Any user can use for viewing the     |
         |             |           |domain name, but not for changing it.|
         |-------------+-----------+-------------------------------------|
         |env          |Environment|Can also be used to set an           |
         |             |           |environment variable.                |
         |-------------+-----------+-------------------------------------|
         |             |           |The fdisk command can also be used to|
         |             |           |make and delete partitions.          |
         |fdisk -l     |Partitions |                                     |
         |             |           |However, the parted utility is more  |
         |             |           |versatile for these purposes. See    |
         |             |           |Partitioning a Hard Drive. (***)     |
         |-------------+-----------+-------------------------------------|
         |hostname -i  |Host Name  |Displays host name and ip address.   |
         |-------------+-----------+-------------------------------------|
         |             |           |  * Useful options include:          |
         |             |           |  * -l : Permissions, owners, sizes, |
         |ls           |Files      |    modification time.               |
         |             |           |  * -i : Inodes.                     |
         |             |           |  * -s : Sizes.                      |
         |-------------+-----------+-------------------------------------|
         |             |           |Usable only from the root account.   |
         |             |Kernel     |For each loaded module, lists:       |
         |lsmod        |modules    |                                     |
         |             |loaded     |  * Name.                            |
         |             |           |  * Size.                            |
         |             |           |  * Referring modules (if any).      |
         |-------------+-----------+-------------------------------------|
         |nslookup     |Domain name|Displays the domain name and address.|
         |host-server  |server     |                                     |
         |-------------+-----------+-------------------------------------|
         |             |Present    |                                     |
         |pwd          |working    |                                     |
         |             |directory  |                                     |
         |-------------+-----------+-------------------------------------|
         |             |           |With different options, the same     |
         |swapon -s    |Swap file  |command can also be used for turning |
         |             |           |on a swap partition.                 |
         |-------------+-----------+-------------------------------------|
         |             |           |Information is given in a single     |
         |             |           |line, in the following order:        |
         |             |cpu and o  |                                     |
         |uname -a     |perating   |  * Operating system.                |
         |             |system     |  * Local host.                      |
         |             |           |  * Kernel release.                  |
         |             |           |  * Kernel build information.        |
         |             |           |  * Processor type.                  |
         |-------------+-----------+-------------------------------------|
         |             |           |For a report on all current users of |
         |             |           |the system, do not specifiy a user.  |
         |             |Current    |                                     |
         |w user       |system     |Displays summaries of:               |
         |             |state      |                                     |
         |             |           |  * System usage.                    |
         |             |           |  * Users who are logged in.         |
         |             |           |  * Current activities of each user. |
         +---------------------------------------------------------------+

***) See Partitioning a Hard Drive, Section 13.3.1.


10.2.2 Commands for Reading Memory Information

         +---------------------------------------------------------------+
         |  Command  |        Topic         |          Comments          |
         |-----------+----------------------+----------------------------|
         |du         |Disk space used by the|You must have read          |
         |directories|contents of a         |permission for each         |
         |           |directory             |directory.                  |
         |-----------+----------------------+----------------------------|
         |           |                      |The name can be: a          |
         |           |                      |partition, a mount point, or|
         |           |                      |a directory.                |
         |           |                      |                            |
         |           |                      |For each file system, the   |
         |           |                      |following information is    |
         |           |                      |given:                      |
         |df -hiT    |Memory used by file   |                            |
         |name       |systems               |  * Size.                   |
         |           |                      |  * Space Used.             |
         |           |                      |  * Space Available.        |
         |           |                      |  * Percentage of space     |
         |           |                      |    used.                   |
         |           |                      |  * Mount point.            |
         |           |                      |  * Inodes.                 |
         |           |                      |  * Filesystem type.        |
         |-----------+----------------------+----------------------------|
         |           |                      |Statistic displayed are:    |
         |           |                      |                            |
         |           |                      |  * Total memory free.      |
         |           |                      |  * Total memory used.      |
         |free -m    |Total system memory   |  * Amount of ram and swap  |
         |           |                      |    memory.                 |
         |           |                      |  * Buffers used by the     |
         |           |                      |    kernel.                 |
         |           |                      |                            |
         |           |                      |Statistics are in megabytes.|
         +---------------------------------------------------------------+

10.2.3 Commands for Reading Process Information

         +---------------------------------------------------------------+
         | Command  |     Topic      |             Comments              |
         |----------+----------------+-----------------------------------|
         |          |                |Unlike most commands, ps does not  |
         |ps auS    |Active processes|use hyphens needed in front of     |
         |          |                |options.                           |
         |----------+----------------+-----------------------------------|
         |          |                |A parent process is one that starts|
         |          |Parent and child|another process.                   |
         |pstree    |processes       |                                   |
         |          |                |A child process is one that is     |
         |          |                |started by another process.        |
         |----------+----------------+-----------------------------------|
         |          |                |Usable only from the root account. |
         |          |                |                                   |
         |          |                |Does not work on nfs files.        |
         |          |                |                                   |
         |          |                |Displays process id s followed by a|
         |fuser -a  |Processes using |code to identify how each process  |
         |files     |a file or       |is using the specified files:      |
         |filesystem|filesystem      |                                   |
         |          |                |  * c : As a directory.            |
         |          |                |  * e : As an executable.          |
         |          |                |  * f : As an open file.           |
         |          |                |  * m : As a shared library.       |
         |          |                |  * r : As the root directory.     |
         |----------+----------------+-----------------------------------|
         |          |Processes that  |The figures given are relative to  |
         |top       |use the most    |each other. They are not the actual|
         |          |system resources|resources used.                    |
         +---------------------------------------------------------------+

10.2.4 Commands for Reading User Information

         +---------------------------------------------------------------+
         |Commands|    Topic     |               Comments                |
         |--------+--------------+---------------------------------------|
         |        |              |Displays information from the psswd    |
         |        |              |file.                                  |
         |finger  |              |                                       |
         |users   |A user        |If no user is specified, information   |
         |        |              |about the current user is displayed.   |
         |        |              |                                       |
         |        |              |Use as root user.                      |
         |--------+--------------+---------------------------------------|
         |        |              |Displays the groups that a user belongs|
         |        |              |to.                                    |
         |groups  |Groups that   |                                       |
         |user    |users belong  |If no user is specified, information   |
         |        |to            |about the current user is displayed.   |
         |        |              |                                       |
         |        |              |Use as root user.                      |
         |--------+--------------+---------------------------------------|
         |id user |Users and     |Displays the user's groups, user id and|
         |        |Groups        |group id s.                            |
         |--------+--------------+---------------------------------------|
         |        |              |Displays:                              |
         |        |              |                                       |
         |        |Users         |  * Users.                             |
         |who     |currently     |  * The time each user has have been   |
         |        |logged on     |    logged in.                         |
         |        |              |  * Each user's remote host (if on a   |
         |        |              |    network).                          |
         |--------+--------------+---------------------------------------|
         |whoami  |Current user  |                                       |
         +---------------------------------------------------------------+

10.2.5 Reading /proc Files

The /proc directory contains several files that are useful when you are configuring or troubleshooting your system.

                   Information Files in the /proc Directory               
     +-------------------------------------------------------------------+
     |   File   |                      Information                       |
     |----------+--------------------------------------------------------|
     |/proc/    |General information about the system, including the     |
     |cpuinfo   |processor type, its speed, and cache size.              |
     |----------+--------------------------------------------------------|
     |/proc/    |Maps irq addresses to devices.                          |
     |interrupts|                                                        |
     |----------+--------------------------------------------------------|
     |/proc/    |Information about parallel ports and the devices        |
     |parport   |attached to them.                                       |
     |----------+--------------------------------------------------------|
     |/proc/    |The system's sound configuration, including the drivers |
     |sound     |installed.                                              |
     +-------------------------------------------------------------------+

[Warning]

Changing these files can damage your system. Regular users should not have write permission to these files, and the root user should be careful about changing them.


10.3 Reading Log Files

Log files record messages about all activities on your system. Some can be viewed by regular users, but many can only be viewed by the root user.

Logs are generally found in the /var/log directory. Their purposes are usually obvious: cron.log lists messages from crontab, daemon.log lists messages from daemons, and so on. The general log file is /var/ log/messages. See Standard Log Files, Section 10.3.2.2.

Logs are controlled by syslogd daemon. This daemon starts almost as soon as your computer starts, and records most events that happen on the system. It is configured in the /etc/syslog.conf file.

You can view logs from either the desktop or the command line. Information is in four column in standard log files.

A few log files are not in the standard format. They cannot be read by using desktop tools, nor, in several cases, by using the standard command line viewing tools. See Non-Standard Log Files.


10.3.1 Reading Standard Log Files From the Desktop

img/Sysinfo-9.png

img/Sysinfo-11.png


10.3.2 Reading Standard Log Files From the Command Line

Standard logs are plain text files. You can use any viewing tools or text editors to view logs from the command line. The most useful tools are less, head, and tail. See Viewing Files From the Command Line, Section 8.6.


10.3.2.1 Keeping a Log File Open Using the tail Command

If you are troubleshooting, you may want to keep a log file open so that you can constantly refer to it:


10.3.2.2 Standard Log Files

         +---------------------------------------------------------------+
         |   Log    |         Contains messages about or from ...        |
         |----------+----------------------------------------------------|
         |auth.log  |Attempts to log on and log off the system.          |
         |----------+----------------------------------------------------|
         |daemon.log|Daemons and attempts to use modprobe.               |
         |----------+----------------------------------------------------|
         |debug     |All parts of the system that might be useful for    |
         |          |trouble-shooting.                                   |
         |----------+----------------------------------------------------|
         |kern.log  |The kernel.                                         |
         |----------+----------------------------------------------------|
         |lpr.log   |The printer.                                        |
         |----------+----------------------------------------------------|
         |mail.err  |Problems with the e-mail subsystem. Duplicates much |
         |          |of the information in mail.warn.                    |
         |----------+----------------------------------------------------|
         |mail.info |General mail information.                           |
         |----------+----------------------------------------------------|
         |mail.warn |Problems with the e-mail subsystem. Duplicates much |
         |          |of the information in mail.err.                     |
         |----------+----------------------------------------------------|
         |messages  |The entire system.                                  |
         |----------+----------------------------------------------------|
         |syslog    |The log daemon.                                     |
         |----------+----------------------------------------------------|
         |user.log  |User activity.                                      |
         +---------------------------------------------------------------+

10.3.2.3 Columns in Standard Log Files

         +---------------------------------------------------------------+
         | Column  |                     Information                     |
         |---------+-----------------------------------------------------|
         |Timestamp|The date and time that the message was written to the|
         |         |log.                                                 |
         |---------+-----------------------------------------------------|
         |Hostname |The machine that generated the message               |
         |---------+-----------------------------------------------------|
         |         |The subsystem that generated the message. The        |
         |         |subsystem can be the kernel or a process.            |
         |Name     |                                                     |
         |         |If the subsystem is a process, then its id is        |
         |         |included.                                            |
         |---------+-----------------------------------------------------|
         |Message  |What the log entry is about.                         |
         +---------------------------------------------------------------+

10.3.3 Reading Non-Standard Log Files

Several useful log files are not in standard format. As a result, they cannot be read by the System log monitor tool on the desktop. Several must be read using unique command line tools.


10.3.3.1 Non-Standard Log Files

     +-------------------------------------------------------------------+
     |    File     |         What It Contains and How to View It         |
     |-------------+-----------------------------------------------------|
     |             |Contains information about the most recent starting  |
     |dmesg        |of the system.                                       |
     |             |                                                     |
     |             |View by using the dmesg command.                     |
     |-------------+-----------------------------------------------------|
     |             |Contains information about the last time users tried |
     |             |to log in, including the number of failures, the     |
     |faillog      |maximum allowed, and the latest failure.             |
     |             |                                                     |
     |             |View by typing: faillog -u user .                    |
     |-------------+-----------------------------------------------------|
     |             |Contains a list of users and the last time they      |
     |lastlog      |logged in.                                           |
     |             |                                                     |
     |             |View by using the lastlog command.                   |
     |-------------+-----------------------------------------------------|
     |             |Contains information about the X Window System.      |
     |XFree86.0.log|                                                     |
     |             |View using the standard command line viewers.        |
     +-------------------------------------------------------------------+

10.3.4 Creating Custom Logs Using Redirection

Error messages for Linux commands display by default in the command line. However, you can redirect messages to a file to create a custom log for a particular command or script. Type: command 2> file.


[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ A ] [ B ] [ C ] [ D ] [ next ]


User's Guide (Obsolete Documentation) (Obsolete Documentation)

Version: 1.00p00, 2009.07.21-11:14

Progeny Linux Systems, Inc.