"Super Simple" Unix/Linux "Display info" commands.

Date : 08/08/2014
Version: 0.91
By : Albert van der Sel
Remarks: The Commands will only display information and not change anything at all.


I just wanted a "Super Simple" file with a few "list" commands *ONLY*, and with little to none comments.


Main Contents:

1. Display SWAP information
2. Display Memory information
3. Display CPU information
4. Display kernel modules / kernel parameters
5. Display Disk info / LVM info
6. Display Packages / patches
7. Display version
8. Display main system log
9. Display networkinterface information
10. Display processes, open files, resource usage etc..



1. Display SWAP information:

############
1.1 AIX:
############
# lsps -a
# lsps -s
# pstat -s

############
1.2 HP-UX:
############
# swapinfo -a
# swapinfo -tam

############
1.3 Solaris
############
# swap -l
# prtswap -l

############
1.4 Linux:
############
# swapon -s
# cat /proc/swaps
# cat /proc/meminfo

############
1.5 FreeBSD:
############
# swapinfo
# pstat -s


2. Display Memory information:

############
2.1 AIX
############
# vmo -L
# vmstat -v
# lparstat -i
# svmon -G
# lsattr -E -l mem0
# lsattr -E -l sys0 -a realmem
# bootinfo -r
# prtconf

############
2.2 HP-UX:
############

# machinfo
# machinfo | grep -i Memory
# dmesg | grep -i phys
# print_manifest
# print_manifest |grep -i memory
# echo "selclass qualifier memory;info;wait;infolog"|cstm
# glance -m
# sam>Performance Monitors>System Properties>Memory Tab # sam is a utility
# cat syslog|grep Phy
# wc -c /dev/mem
# swapinfo -tam

("print_manifest" comes with ignite)

############
2.3 Solaris:
############
# dmesg | grep mem
# prtdiag | grep Memory
# prtconf -v | grep Memory
# prtmem
# memps -m

############
2.4 Linux:
############
# cat /proc/meminfo
# dmesg | grep -i memory
# free
# free -m # in MB
# dmidecode --type 17

############
2.5 FreeBSD:
############
# dmesg | grep -i memory
# grep memory /var/run/dmesg.boot
# sysctl -a | grep mem


3. Display CPU information:

############
3.1 AIX:
############
# lparstat -i
# prtconf
# pmcycles -m
# lsattr -El procx (x is 0,2, etc..)
# lscfg | grep proc
# pstat -S
# mpstat
# lsdev -Cc processor

############
3.2 HP-UX:
############

# machinfo
# ioscan -kfnC processor
# getconf CPU_VERSION
# getconf CPU_CHIP_TYPE
# model
# print_manifest

############
3.3 Solaris:
############
# psrinfo -v
# prtconf
# psrset -p
# prtdiag

############
3.4 Linux:
############
# cat /proc/cpuinfo
# dmesg | grep -i cpu
# lscpu
# lshw -class cpu
# lshw -class cpu -short
# dmidecode --type 4

############
3.5 FreeBSD:
############
# sysctl hw.model
# sysctl -a | egrep -i 'hw.machine|hw.model|hw.ncpu'
# dmesg | grep -i cpu
# uname -p


4. Display kernel modules / kernel parameters:

############
4.1 AIX:
############

# genkex
# vxketadm -s

# vmo
# ioo
# schedo
# lsattr -El sys0

############
4.2 HP-UX:
############

# kcmodule
# kcmodule -v vxfs

# lsdev
# sysdef
-> using the "kcweb" web interface
-> using the utility "sam"
# kcweb -t
# kmtune # kmtune is an "older" wrapper over kctune
# kctune
# kctune -d
# kctune -v
# kctune -g
# kcusage
# print_manifest

- get the current system file:
# cd /stand/build
# /usr/lbin/sysadm/system_prep -v -s system

############
4.3 Solaris:
############

# modinfo
# modinfo -i 5 #(info on module with id 5)

# ls -lR /proc/sys
# cat /etc/system
# sysdef -i
# adb -k

############
4.4 Linux:
############

# modprobe -l
# modprobe -l abc*
# lsmod
# modinfo

-> browse around in /proc
-> browse around in /sys
# cat /etc/sysconfig/kernel
# cat /etc/sysctl.conf
# sysctl -a

############
4.5 FreeBSD:
############

# kldstat

# sysctl -a
# cat /boot/loader.conf
# cat /etc/sysctl.conf


5. Display Disk info / LVM info:

Note (!): This is on every platform a very wide subject.
Below is very summier info.

############
5.1 AIX:
############

---------------------------------------------------------
(1). Viewing (static) mounts/mountpoints associated with devices/filesystems:
---------------------------------------------------------
# cat /etc/filesystems

---------------------------------------------------------
(2). Showing sizes (used/free) of filesystems:
---------------------------------------------------------
# df -h
# df -m #(in MB)

---------------------------------------------------------
(3). Physical Volumes (PV's):
---------------------------------------------------------

hdisk0, hdisk1, hdisk2 etc.. naming for local disks, or LUNs (depending driver/san/access method).
vpath0, vpath1, vpath2 etc.. naming for LUNs (depending driver/san/access method).

Physical disks are always grouped in LVM "Volume Group(s)".

Display physical disks:

# lsdev -Cc disk
# lspv
# lspv -p hdisk3
# lspv -l hdisk3

---------------------------------------------------------
(4). Volumegroups (VG's):
---------------------------------------------------------
The "rootvg" is mandatory, other VG's can have names as you want them to have, like "oravg".

# lsvg
# lsvg oravg
# lsvg -l oravg
# lsvg -p datavg

---------------------------------------------------------
(5). Logical Volumes (LV's):
---------------------------------------------------------

# lslv -l lv06

In "rootvg", the following logical volumes exists:
hd4= /, hd5=boot, hd6=paging, hd2=/usr, hd3=/tmp, hd9var=/var

############
5.2 HP-UX:
############

---------------------------------------------------------
(1). Viewing (static) mounts/mountpoints associated with devices/filesystems:
---------------------------------------------------------

# cat /etc/fstab

---------------------------------------------------------
(2). Showing sizes (used/free) of filesystems:
---------------------------------------------------------
# bdf
# df -k

---------------------------------------------------------
(3). Disk info: Disk names/devices/identifiers:
---------------------------------------------------------

=> Traditional : /dev/dsk/cXtYdZ (block)
=> Newer agile device files: /dev/disk/diskN (block)

Using "ioscan":

# ioscan

- Traditional or legacy (showing hardware path):

# /usr/sbin/ioscan -C disk

-Agile:

# /usr/sbin/ioscan -N -C disk

-Hardware paths or LUN paths:

# ioscan -efunC disk

# ioscan -fkNC lunpath

Newer "agile" means "path" independence.

# pvdisplay -v
# pvdisplay /dev/dsk/c1t0d0
# pvdisplay -v /dev/dsk/c2t0d0

using the newer "Agile" representation:

# pvdisplay /dev/disk/disk22

# diskinfo -v /dev/rdsk/cXtYdZ

=> Since HPUX 11i later releases, we can use Agile device files too like for example

/dev/disk/disk7 (block)
/dev/rdisk/disk7 (character)

and partitions like:

/dev/disk/disk7_p2
/dev/rdisk/disk7_p2

=> More information on device files might be obtained using the "lssf" command like:

# /usr/sbin/lssf /dev/rdsk/*

=> Show boot, root, dump, swap:

# lvlnboot -v

---------------------------------------------------------
(4). Volumegroups:
---------------------------------------------------------
Usually vg00, vg01 etc.. rootfs is contained in vg00.

# vgdisplay vg00
# vgdisplay -v /dev/vg02
# vgdisplay -v vgdata

# ls -al /dev/vg* | more

---------------------------------------------------------
(5). Logical Volumes (LV's):
---------------------------------------------------------

/dev/vgxx/lvoln (block device files)
/dev/vgxx/rlvoln (character device files)

where xx represents the volume group that the logical volume belongs to,
and n represents the logical volume number within that volume group.

# lvdisplay /dev/vg00/lvol2
# lvdisplay -v /dev/vg00/lvol2

############
5.3 Solaris:
############

---------------------------------------------------------
(1). Viewing (static) mounts/mountpoints associated with devices/filesystems:
---------------------------------------------------------
# cat /etc/vfstab

---------------------------------------------------------
(2). Showing sizes (used/free) of filesystems:
---------------------------------------------------------
# df -k
# df -t

# du -s /home/fred #shows a total summary of /home/fred

# du -sg /data #shows a total summary of /data in GB

---------------------------------------------------------
(3). Disk names/devices/identifiers:
---------------------------------------------------------

=> traditional:

A logical device name for a disk drive has the following format:

/dev/[r]dsk/cXtYdZsW

where cx refers to the SCSI controller number, tx to the SCSI bus target number,
dx to the disk number (always 0 except on storage arrays)
and sx to the slice or partition number.

---------------------------------------------------------
(4). SCSI and disks:
---------------------------------------------------------

From the pre-boot OK prompt:

ok probe-scsi

- HBA's:

# cfgadm -l

Ap_Id.............Type.........Receptacle.... Occupant......Condition
c0................scsi-bus.....connected..... configured....unknown
c1................scsi-bus.....connected..... unconfigured..unknown
usb0/1............unknown......empty......... unconfigured..ok

- devices:

# cfgadm -al

Ap_Id...................Type........Receptacle.......Occupant..........Condition
c0......................scsi-bus....connected........configured........unknown
c0::dsk/c0t0d0..........disk........connected........configured........unknown
c0::dsk/c0t1d0..........disk........connected........configured........unknown
c0::dsk/c0t2d0..........disk........connected........configured........unknown
c0::dsk/c0t3d0..........disk........connected........configured........unknown
c1......................scsi-bus....connected........unconfigured......unknown
usb0/1..................unknown.....empty............unconfigured......ok

# cfgadm -al -o show_SCSI_LUNS c5

# cfgadm -al -o show_FCP_dev c5

# fcinfo hba-port

# fcinfo -sl -p HBA-Port-WWN

# luxadm -e port

=> ZFS list commands:

# zpool status -x
# zpool status
# zpool status -v mypool
# zpool list
# zpool list mypool
# zpool list -o name,size
# zpool history -l mypool
# zpool iostat 2
# zfs list
# zfs list -t snapshot


############
5.4 Linux:
############

---------------------------------------------------------
(1). Viewing (static) mounts/mountpoints associated with devices/filesystems:
---------------------------------------------------------
# cat /etc/fstab

---------------------------------------------------------
(2). Showing sizes (used/free) of filesystems:
---------------------------------------------------------
# df -h
# df -T

---------------------------------------------------------
(3). Disk names/devices/identifiers:
---------------------------------------------------------

=> Standard disk device (files):

/dev/sda - first SCSI disk (address-wise)
/dev/sdb - second SCSI disk (address-wise)
/dev/hda - master disk on IDE primary controller
/dev/hdb - slave disk on IDE primary controller
/dev/hdc - master disk on secondary controller
/dev/hdd - slave disk on secondary controller

Often, LUNs are numbered likewise, like sde, sdf etc..

=> From older arrays, devices might look like:

/dev/cciss/c0d0 Controller 0, disk 0, whole device
/dev/cciss/c0d0p1 Controller 0, disk 0, partition 1
etc..

or

/dev/dsk/cXtYdZ

=> Show LVM Physical Volumes:

# pvdisplay

=> Show ordinary disk/partitions:

# cat /proc/partitions
# fdisk -l
# fdisk -l /dev/sda
# lshw -class disk
# lshw -C disk
# ls /dev/disk/by-id
# sfdisk -l
# sfdisk -l /dev/sda
# lsscsi
# lsblk -f
# blkid
# blkid /dev/sda
# smartctl -i /dev/sda
# hwinfo --disk

---------------------------------------------------------
(4). Volumegroups:
---------------------------------------------------------

# vgdisplay

---------------------------------------------------------
(5). Logical Volumes (LV's):
---------------------------------------------------------

# lvdisplay


6. Display Packages / patches:

############
6.1 AIX:
############
# instfix -ik APAR_number
# lslpp -h fileset1, fileset2
# lslpp -l fileset
# lslpp -w "*whatever*"
# lslpp -l | grep -i whatever

rpm works as well

############
6.2 HP-UX:
############
# swlist -l patch
# swlist -l bundle
# swlist -l product
# swlist | grep patch

############
6.3 Solaris:
############
# showrev -p
# pkginfo
# pkginfo -i package_name
# patchadd -p
# pkgchk -l -p (file belongs)

############
6.4 Linux:
############
# rpm -qa
# rpm -q packagename
# rpm -qa | grep whatever
# rpm -qlp whatever.rpm
# yum list mypackage
# yum search whatever

############
6.5 FreeBSD:
############
# pkg_info
# pkg_version
# pkg_info -a
# pkg_info | grep 'packagename'
# pkg_info -L package


7. Display Version:

############
7.1 AIX:
############
# oslevel -r
# oslevel -s
# bootinfo -K
# lslpp -l bos.64bit
# genkex |grep 64

############
7.2 HP-UX:
############
# uname -r
# what /stand/vmunix
# getconf KERNEL_BITS
# file /stand/vmunix
# machinfo

############
7.3 Solaris
############
# cat /etc/release
# uname -a
# isainfo -v

############
7.4 Linux:
############
# cat /proc/version
# uname -r
# uname -a
# cat /etc/redhat-release
# cat /etc/SuSE-release
# cat /etc/*release

############
7.5 FreeBSD:
############
# uname -r
# uname -a


8. Display main system log:

- Often, use "cat" (or "more") to view logs, and optionally use "grep" to filter.
- Often, "dmesg" shows kernel messages plus bootinfo.
- Often, multiple logfiles live in (or subdirs in) "/var/log" or "/var/adm/".

############
8.1 AIX:
############
# errpt
# errpt | grep -i WhatEverString
# errpt -a
# errpt -aj ErrorIdentifier

############
8.2 HP-UX:
############
# cat /var/adm/syslog/syslog.log | more
# cat /var/adm/syslog/syslog.log | grep -i WhatEverString

############
8.3 Solaris:
############
# cat /var/adm/syslog | more
# cat /var/adm/messages | more
# more /var/adm/messages
# cat /var/adm/messages | grep -i WhatEverString

############
8.4 Linux:
############
# cat /var/log/messages | more
# cat /var/log/messages | grep -i WhatEverString
# more /var/log/messages

############
8.5 FreeBSD:
############
# cat /var/log/messages | more
# cat /var/log/messages grep -i WhatEverString


9. Display network interface information:

############
9.1 AIX:
############

-- some main config files:

# cat /etc/resolv.conf # nameservers
# cat /etc/named.conf
# cat /etc/netsvc.conf # order of names resolution
# cat /etc/hosts # IPAddress-Hostname mappings
# cat /etc/inetd.conf # inet daemons configfile

-- interface info:

# lsdev -Cc adapter | grep ent
# lsdev -Cc if
# lsattr -El ent1

# smitty inet
# smitty mkinet
# smitty chgenet
# smitty tcpip

# ifconfig -a
# ifconfig en0

# entstat -d en0

############
9.2 HP-UX:
############

-- some main config files:

# cat /etc/resolv.conf # nameservers
# cat /etc/netconfig # netconfiguration
# cat /etc/named.conf
# cat /etc/nsswitch.conf # order of names resolution
# cat /etc/hosts # IPAddress-Hostname mappings
# cat /etc/inetd.conf # inet daemons configfile
# cat /etc/rc.config.d/netconf # Contains hostname, ip address, default route

-- interface info:

# lanscan
# lanadmin

# nwmgr # nwmgr is the new way, it provides plenty interface info
# nwmgr --get
# nwmgr -g
# nwmgr -q info -c lan0

# ifconfig
# for i in `netstat -rn |grep lan |cut -c55-59 |sort |uniq`; do ifconfig $i; done
# for i in `lanscan -i | awk '{print $1}'` ; do ifconfig $i ; done
# netstat -i, netstat -rn
# netstat -s # shows stats

############
9.3 Solaris:
############

-- some main config files:

# cat /etc/defaultrouter
# cat /etc/inet/hosts -> /etc/hosts
# cat /etc/inet/netmasks
# cat /etc/bootparams
# cat /etc/ethers
# cat /etc/inet/networks
# cat /etc/inet/protocols
# cat /etc/inet/services

# cat /etc/resolv.conf # nameservers
# cat /etc/named.conf
# cat /etc/nsswitch.conf # order of names resolution
# cat /etc/hosts # IPAddress-Hostname mappings

-- interface info:

# prtdiag | grep "card"
# prtconf
# kstat -c net | grep net
# kstat -c net | more
# svcs -x
# ifconfig -a
# dladm show-link
# ipadm show-if
# ipadm show-addr

############
9.4 Linux:
############

-- some main config files:

Depends on distro, but You might try to take a look in the following
directories (or files), if they exists on your system:

/etc/network (directory)
/etc/network/interfaces (directory)
/etc/network/interfaces (as a file)
/etc/sysconfig/network (as a file)
/etc/sysconfig/network-scripts/ifcfg- (as a file)

and common ones:

# cat /etc/resolv.conf # nameservers
# cat /etc/nsswitch.conf # order of names resolution
# cat /etc/hosts # IPAddress-Hostname mappings
# cat /etc/inetd.conf # inet daemons configfile

-- interface info:

# netstat -nr
# netstat -i

# ifconfig eth0

# lshw -class network

# lspci
# lspci | grep -i eth
# lspci | egrep -i --color 'wifi|wlan|wireless'

# dmesg | grep eth
# ethtool eth0
# grep eth0 /etc/modules.conf


10. Display processes, open files, libraries in use, utilization etc..:

In this case, it's not neccessary to shift commands in seperate OS'ses,
since over most systems, at least for the commands I want to show here,
they are very similar.

But there are exceptions ofcourse. Just try a "command", or use "man command"
to see if it would work, and to see examples or syntax for your system.

-------------------------------------------------------------------
10.1 Display which processes uses a certain mountpoint (disksystem):
-------------------------------------------------------------------

# fuser -c mountpoint (like e.g. fuser -c /backups)

See also 10.2

-------------------------------------------------------------------
10.2 Display which processes uses a certain file, or resource:
-------------------------------------------------------------------

10.2.1 fuser:
-------------

-which process uses a file?

# fuser -u /home/miranda/accounts.txt

10.2.2 lsof:
------------

The "lsof" (list open files) utility is not available for all unixes.
However, you can always just try it, like:

-which processes uses the a certain file?

# lsof /etc/passwd
# lsof +fg /data/oracfg

or just use the "long" listing (all files) and grep it on the filename:

# lsof | grep MyFile

-which processes uses /dev/cdrom?

# lsof /dev/cdrom

-what files is the pid 3563 using?

# lsof -p 3563
# lsof -c somedaemon

-p [pid], -c [name], -u [userid]

The "pfiles" command (on some unixes) have similar functionality.

-------------------------------------------------------------------
10.3 Display full process list on your system:
-------------------------------------------------------------------

# ps -ef (full listing dumped "all at once")
# ps -ef | more (one screen at the time)
# ps -ef | grep -i WhatEverString (like ps -ef | grep -i ora)

-------------------------------------------------------------------
10.4 Display processes and utilization (%cpu and others):
-------------------------------------------------------------------

Using ascii "graphical" (with real-time updates) screens:

# top (often available on most unixes/linux)
# nmon (often available on most unixes/linux)
# topas (often available on e.g. AIX)
# glance (often available on HPUX)

-------------------------------------------------------------------
10.5 Display processes and mem usages and files:
-------------------------------------------------------------------

PID is the "Process ID" which you, for example, can find using "ps -ef".
The commands below strongly depends on the OS.

You might try:

# procmap pid (in e.g. AIX)
# proctree pid (in e.g. AIX)
# pmap -x pid (in e.g. Solaris)
# kmeminfo -pid pid (in HPUX, but may need to be obtained)

# pfiles pid (in e.g. Solaris)
# pldd pid (in e.g. Solaris)
# ptree pid (in e.g. Solaris, or pstree in Linux)

# svmon -G (in e.g. AIX)
# svmon -U (in e.g. AIX)
# svmon -P -t 10 (in e.g. AIX: top 10 users)
# svmon -U steve -l (in e.g. AIX: memory stats for user steve)



That's it! Hope you liked it!