Skip to content

Instantly share code, notes, and snippets.

@hamidreza-s
Created January 11, 2016 13:14
Show Gist options
  • Save hamidreza-s/01f9a5e935450a3810f4 to your computer and use it in GitHub Desktop.
Save hamidreza-s/01f9a5e935450a3810f4 to your computer and use it in GitHub Desktop.
Super simple Unix/Linux "Display" commands.
/*****************************************************************/
/* Super Simple Unix/Linux "Display" commands. */
/* */
/* file : unixcommands.txt */
/* Date : 02/02/2013 */
/* Version: 0.3 */
/* 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 "list" commands *ONLY*,
and with little to none comments.
But...,
1. Maybe some commands are too old, or too new, for your system.
2. Maybe some commands are version dependent (looks like 1.)
3. Maybe some commands requires additional packages to be installed first.
Contents:
=========
1. Display SWAP information
2. Display Memory information
3. Display CPU information
4. Display kernel modules
5. Display Disk info / LVM info
6. Display Packages / patches
############################################################
1. Display SWAP information:
############################################################
############
1.1 AIX:
############
# lsps -a
# lsps -s
# pstat -s
############
1.2 HP:
############
# 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:
############
# getmem
# print_manifest |grep –i memory
# echo "selclass qualifier memory;info;wait;infolog"|cstm
# dmesg | grep -i phys
# glance -m
# sam>Performance Monitors>System Properties>Memory Tab # utility
# cat syslog|grep Phy
# wc -c /dev/mem
# machinfo | grep Memory
############
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 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:
############
# ioscan -kfnC processor
# getconf CPU_VERSION
# getconf CPU_CHIP_TYPE
# model
############
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:
############################################################
############
4.1 AIX:
############
# genkex
# vxketadm -s
############
4.2 HP:
############
# kcmodule
# lsdev
# sysdef
############
4.3 Solaris:
############
# modinfo
############
4.4 Linux:
############
# modprobe -l
# modprobe -l abc*
# lsmod
############
4.5 FreeBSD:
############
# kldstat
############################################################
5. Display Disk info / LVM info:
############################################################
Note (!): This is on every platform a very wide subject.
Almost everthing is omitted.
############
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:
############
---------------------------------------------------------
(1). Viewing (static) mounts/mountpoints associated with devices/filesystems:
---------------------------------------------------------
# cat /etc/fstab
---------------------------------------------------------
(2). Showing sizes (used/free) of filesystems:
---------------------------------------------------------
# bdf
# df -k
---------------------------------------------------------
(3). Disk names/devices/identifiers:
---------------------------------------------------------
# pvdisplay -v
# pvdisplay /dev/dsk/c1t0d0
# pvdisplay -v /dev/dsk/c2t0d0
# diskinfo -v /dev/rdsk/cXtYdZ
---------------------------------------------------------
(4). Volumegroups:
---------------------------------------------------------
Usually vg00, vg01 etc..
# vgdisplay vg00
# vgdisplay -v /dev/vg02
# vgdisplay -v vgdata
# ls -al /dev/vg* | more
---------------------------------------------------------
(5). Logical Volumes (LV's):
---------------------------------------------------------
# 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
---------------------------------------------------------
(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). Volumegroups (VG's) / Logical Volumes (LV's)::
---------------------------------------------------------
- We don't list The older "Solaris Volume Manager" with "meta" commands here.
- ZFS as a LVM
- Veritas
############
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 List Packages / patches:
############################################################
############
6.1 AIX:
############
# instfix -ik APAR_number
# lslpp -h fileset1, fileset2
# lslpp -l fileset
# lslpp -w "*whatever*"
# lslpp -l | grep whatever
rpm works as well
############
6.2 HP:
############
# 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> (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
End Of File
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment