Thursday 3 November 2011

LINUX STATUS COMMANDS

Linux Status Commands
                        uptime provides an instantaneous summary such as
11:42pm up 18 days, 8:45, 5 users, load average: 0.01, 0.03, 0.07
For the current time, the Number of days up since last boot, the number of users currently logged in, and the load average for the last 1, 5, and 15 minute intervals.
ReminderThe load average (LA) is the average number of processes (the sum of the run queue length and the number of jobs currently running) that are ready to run, but are waiting for access to a busy CPU. Averages from 0 to 1.0 are acceptable for a single CPU. As a general rule of thumb, a machine is being overworked if load averages consistently exceed three times the number of CPUs.
                        top provides load average with auto refresh and additional data (sorted by %CPU):
68 processes: 67 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: 12.2% user, 1.6% system, 0.0% nice, 86.1% idle
Solaris comes with the prstat command to provide this info. Graphical versions of this include gtop within Gnome and the KDE Process Monitor.
For memory usage, press M.
For CPU info, press P.
To stop display, enter q.
The 'SIZE' field is the total virtual memory size of each process, including all code, data, stack, mapped files, libraries etc.
                        procinfo -fn30 is used to gather system data from the /proc directory every 30 seconds.
o    Last Boot time
o    Load Average
§  average number of jobs running
§  number of runnable processes
§  total number of processes
§  PID of the last process run (idem)
o    Swap info
o    Memory resources
o    Number of disks
o    IRQ info
o    Installed modules (with the -a or -m option)
o    File Systems (with the -a or -m option)
                        xos provides a constantly updated colorful summary view of various components.
 




Set screenProcess stats
  • ps -a lists by ID processes spawned by the current user from the current shell.
Option -f shows child processes. For each Unique Process ID (PID):
"SIZE" = Virtual image size; KB of text+data+stack Or "SZ" in Solaris, for memory consumption.
"RSS" = Resident Set Size (kilobytes of program in memory).
"SHARE" = Amount of shared memory used by the task.
"TTY" = Controlling tty on which the process was started.
"STAT" = Status of each process. In Solaris, "S":
S = Sleeping
R = Running (active)
D = uninterruptible sleep
T = traced (stopped)
Z = zombie process
Second field = "W" if the process has no resident pages.
Third field = "N" if the process has a positive nice value. "NI" in Solaris for The nice value (priority) of the process.
In solaris, option -l (for long) shows these additional columns:
"F" for any flags set by the process.
"ADDR" for the number of memory addresses used by the process.
"WCHAN" for the memory addresses for processes that are sleeping.
"PPID" for the parent process ID.
"PRI" for the process priority cc"C" for the scheduling class of the process.
"STIME" for the date/time when the process was started.
ps -a lists the most frequently requested processes.
Other flags include:
-d Lists all processes
-t Lists all processes associated with a specific terminal
-u Lists all processes for a specific user
-f Prints comprehensive process information
-c Lists processes in scheduler format
-g Prints process information on a group basis for a single group
-G Prints process information on a group basis for a list of groups
-j Includes SID and PGID in printout
-l Prints complete process information
-L Displays LWP details
-p Lists process details for list of specified process
-P Lists the CPU ID to which a process is bound
-s Lists session leaders
To filter only processes of the current user in Linux:
ps aufx | grep $USER
To scroll up and down in Linux:
ps -a | less
Syntax:
ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [-l] [-L] [-P] [-y] [ -g grplist ] [ -n namelist ] [-o format ] [ -p proclist ] [ -s sidlist ] [ -t term] [ -u uidlist ] [ -U uidlist ] [ -G gidlist ]
-a
List information about all processes most frequently requested: all those except process group leaders and processes not associated with a terminal.
-A
List information for all processes. Identical to -e, below.
-c
Print information in a format that reflects scheduler properties as described in priocntl. The -c option affects the output of the -f and -l options, as described below.
-d
List information about all processes except session leaders.
-e
List information about every process now running.
-f
Generate a full listing. 
-j
Print session ID and process group ID.
-l
Generate a long listing.
-L
Print information about each light weight process (lwp) in each selected process.
-P
Print the number of the processor to which the process or lwp is bound, if any, under an additional column header, PSR.
-y
Under a long listing (-l), omit the obsolete F and ADDR columns and include an RSS column to report the resident set size of the process. Under the -y option, both RSS and SZ will be reported in units of kilobytes instead of pages.
-g grplist
List only process data whose group leader's ID number(s) appears in grplist. (A group leader is a process whose process ID number is identical to its process group ID number.)
-n namelist
Specify the name of an alternative system namelist file in place of the default. This option is accepted for compatibility, but is ignored.
-o format
Print information according to the format specification given in format. This is fully described in DISPLAY FORMATS. Multiple -o options can be specified; the format specification will be interpreted as the space-character-separated concatenation of all the format option-arguments.
-p proclist
List only process data whose process ID numbers are given in proclist.
-s sidlist
List information on all session leaders whose IDs appear in sidlist.
-t term
List only process data associated with term. Terminal identifiers are specified as a device file name, and an identifier. For example, term/a, or pts/0.
-u uidlist
List only process data whose effective user ID number or login name is given in uidlist. In the listing, the numerical user ID will be printed unless you give the -f option, which prints the login name.
-U uidlist
List information for processes whose real user ID numbers or login names are given in uidlist. The uidlist must be a single argument in the form of a blank- or comma-separated list.
-G gidlist
List information for processes whose real group ID numbers are given in gidlist. The gidlist must be a single argument in the form of a blank- or comma-separated list.

Set screenrpc.rstatd stats
To obtain statistics from each UNIX machine (through port 111), use rpc.rstatd subserver daemon invoked by the inetd subsystem controlled by /etc/inet/inetd.conf
3.  $ tar xvzf rstatd.tar.gz
4.  $ cd rpc.rstatd
5.  $ ./configure --prefix=/usr
6.  $ make
7.  # sudo su
8.  # make install
    1. Add a line to the hosts.allow file within /etc/ to specify the subnet(s) allowed to make rstatd requests. For example:
10.rpc.rstatd: 10.0.95.0/255.255.255.0 10.0.8.0/255.255.255.0
Alternately, if you want to live dangerously:
rpc.rstatd: ALL
    1. Add rstatd entry in /etc/xinetd.d/rstatd:
12.# default: off
13.# description: An xinetd internal service which rstatd's characters back to clients.
14. 
15.service rstatd
16.{
17.    type            = RPC
18.    rpc_version     = 2-4
19.    socket_type     = dgram
20.    protocol        = udp
21.    wait            = yes
22.    user            = root
23.    only_from       = 10.0.95.0/24
24.    log_on_success  += USERID
25.    log_on_failure  += USERID
26.    server          = /usr/sbin/rpc.rstatd
27.    disable         = no
28.}
    1. Restart xinetd:
# /etc/rc.d/init.d/xinetd restart
To start rpc.rstatd under Red Hat Linux, run as root
/etc/rc.d/init.d/rstatd start
Set screenRstatd vs. SAR
rstatd
SAR
o    Collisions rate - Collisions per second detected on the Ethernet network wire.
o    Incoming packets errors rate - Errors per second while receiving Ethernet packets.
o    Incoming packets rate - Incoming Ethernet packets per second.
o    Outgoing packets rate - Outgoing Ethernet packets per second.
o    Paging rate - Number of pages read to physical memory or written to pagefile(s), per second.
o    Page-in rate - Number of pages read to physical memory, per second.
o    Page-out rate - Number of pages written to pagefile(s) and removed from physical memory, per second.
o    Average load - Average number of processes simultaneously in 'Ready' state during the last minute.
o    Context switches rate - Number of switches between processes or threads, per second.
o    Swap-in rate - Number of processes being swapped into memory, per second.
o    Swap-out rate - Number of processes being swapped out from memory, per second.
o    CPU utilization - Percent of time that the CPU is utilized.
o    System mode CPU utilization - Percent of time that the CPU is utilized in system mode.
o    User mode CPU utilization - Percent of time that the CPU is utilized in user mode.
o    Disk rate - Rate of disk transfers, per second.
o    Interrupts rate - Number of device interrupts per second.
These statistics are queried and displayed using the perfmeter OpenWindows XView utility

Go to Top of this page.
Previous topic this page
Next topic this page