Common Unix Commands: Sysinfo
Common Unix Commands: Sysinfo
sysinfo
cat /proc/version
lspci
prtdiag -v lspci lsusb ioscan
prtconf -D lsusb lshal ioscan -fun [disk|tape|lan]
prtpicl -v [-c <class>] lshal
/opt/ignite/bin/print_manifest
picl = platform information and control Note: hal = hardware abstraction layer cat /var/opt/ignite/local/manifest/manifest.info
library
Hardware Info
Display Firmware At the OK prompt type banner boot into the BIOS (normally F2 or F12) boot into the BIOS (normally F2 or F12)
workstations:
reboot
enter PDC
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 2 of 11
page size /usr/bin/pagesize /usr/bin/getconf -a| egrep -i /usr/bin/getconf -a| egrep -i dmesg |grep -i physical pagesize
(memory) 'pagesize|page_size' 'pagesize|page_size' pagesize -a (display all supported pagesizes)
swap -l cat /proc/swaps (detailed) cat /proc/swaps (detailed) swapinfo (displayed in KB) lsps -a (detailed)
display swap swap -s swapon -s swapon -s swapinfo -m (display in Mb) lsps -s
swapinfo -tm (total / Mb)
device: Create logical volume or filesystem mkps -a -s 4 -n <volume group>
mkfile 5m /var/swapfile device: create partition with fdisk (type
swap -a /var/swapfile create partition with fdisk (type 82) 82) swapon <device> | -f <logical device> # change the attributes
file(create 50MB swap file): file(create 50MB swap file): swapon -p 3 <device> | -f <logical device> chps -a n paging00 (don't use after restart)
update /etc/vfstab dd if=/dev/zero of=/var/swapfile dd if=/dev/zero of=/var/swapfile
bs=1024 count=50000 bs=1024 count=50000 update /etc/fstab # change the logical volume attributes (name in this
chlv -n <new name> <old old> (chang page space nam
adding swap mkswap <device>|<file> mkswap <device>|<file> Note: -p = priority swap number . The nswapdev
swapon <device>|<file> swapon <device>|<file> tunable system parameter controls the maximum Note:
number of swap devices.
update /etc/fstab update /etc/fstab -a reconfigure paging space after restart
-s size of the page space (logical partitions)
-n activiates the paging space (use swapoff to deacti
Note:
EFI - Extensible Firmware Interface
SMI - Sun Microsystems Inc
sdparm -i /dev/sdb sdparm -i /dev/sdb ## Insure that the online diagnostic support to
have been installed
cat /proc/ide/ide0/hda/model cat /proc/ide/ide0/hda/model swlist -l bundle | grep 'Support Tools'
Disk serial Number, type, cat /proc/scsi/scsi cat /proc/scsi/scsi
etc ## Command-Line Support Tools Manager (cstm
## The run cstm
cstm
cstm> map
cstm> sel dev 4 (select the disk of you cho
cstm> info
cstm> il (obtain the serial number)
cstm> quit
prtvtoc <device>
fdisk -l fdisk -l lvlnboot -v /dev/vg00
cat /etc/vfstab sfdisk -l (advanced server) sfdisk -l (advanced server) lifls -Clv <device>
cat /proc/partitions (very high level) cat /proc/partitions (very high level) # Display the LIF contents
cat /etc/fstab cat /etc/fstab lifcp /dev/dsk/c0t6d0:AUTO -
cat /etc/fstab
Disk disk partitions
Note: Boot programs are stored in the boot ar
Logical Interchange Format (LIF), which is sim
a file system. For a device to be bootable, the
volume on that device must contain at least t
(the initial system loader) and HPUX (the HP-U
bootstrap utility) LIF files. ISL is like GRUB.
List Raw Partitions use format to partition the disk then just use mknod /dev/rawctl c 162 0 Just create a new LVOL without a filesystem -
the slice as a raw partition, remember to use ## Old way mknod /dev/raw/raw0 c 162 1 it.
the character device /etc/sysconfig/rawdevices mknod /dev/raw/raw1 c 162 2
service rawdevices start ln -s /dev/rawctl /dev/raw/rawctl
chkconfig rawdevices on
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 3 of 11
## New way, Edit below file ## map raw devices to the disk
/etc/udev/rules.d/60-raw.rules raw /dev/raw/raw1 /dev/sdb1
udevinfo -d or udevadm info
## display raw devices
## Display raw partitions raw -qa
raw -qa
newfs -v <raw device> mkfs -t ext3 /dev/sdb1 newfs -F vxfs -o largefiles /dev/vg01/rlvol1
mkfs -t ext3 /dev/sdb1
# Display how the filesystem was created mke2fs -t ext4 /dev/sdb1 mkfs -F vxfs -o largefiles /dev/vg01/rlvol1
newfs -Nv <filesystem>
# all point to mke2fs Note: mkfs and newfs are a pointer
mkfs.ext2 to /sbin/fs_wrapper
mkfs.ext3
mkfs.ext4
Filesystem (create|remove)
cat /etc/mke2fs.conf
touch /forcefsck
touch /forcefsck shutdown -r now
shutdown -Fr now
fsck.mode=force (kernel parameter)
Force fsck # Check to see filesystem needs checking tune2fs -l /dev/sdb<?> |grep -i 'filesystem state'
fstyp -v <filesystem> | grep fsclean # Look at the second line to see if a filesystem
tune2fs -l /dev/sdb<?> |grep -i 'filesystem state' # edit /etc/default/rcS change below so # needs checking
# you dont have to hang around tunefs -v <filesystem>
FSCKFIX=yes
ufsdump|ufsrestore dump/restore dump/restore fbackup/frecover
tar tar tar dump/restore
dd dd dd ftio
backup filesystem
cpio cpio cpio tar
dd
cpio
eeprom |grep boot-device cat /boot/grub/menu.lst setboot
prtconf -pv |grep bootpath cat /boot/grub/grub.conf
prtpicl -v|grep ':bootpath' cat /etc/lilo.conf
Display the boot device
grub = grand unified boot loader
lilo = linux loader
remount a filesystem
n/a mkbootdisk `uname -r` (boot diskette) n/a recovery tape (preview)
create boot disk or
make_tape_recovery -v -l -x inc_entire=vg00
recovery tape
/opt/ignite/bin/make_recovery -ACv
boot cdrom/diskette (single ok> boot cdrom -s using the grub window append the word single to using the grub window append the word single to enter PDC
user) the kernel line the kernel line > search
> boot p1 (cdrom)
interact with IPL? Y
ISL> hpux -is
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 4 of 11
floppy:
floppy: floppy: floppy:
disk: /dev/fd0 /dev/fd0 n/a
/dev/dsk/c0t0d0s0
disk: disk: disk:
tape: /dev/hda or /dev/sda /dev/hda or /dev/sda /dev/dsk/c0t6d0
/dev/rmt/0ucb /dev/hdb or /dev/sdb /dev/hdb or /dev/sdb
Device paths tape:
cdrom: tape: tape: /dev/dsk/rmt/0
/dev/dsk/c0t6d0s0
/dev/scd0 (external usb cd) cdrom: cdrom: cdrom:
/dev/hda (depends on number of IDE disks) /dev/hda (depends on number of IDE disks) /dev/dsk/c1t6d0
Networking
module:instance:name:statistics
# Solaris 11
netadm list
displaying network interfaces
dladm show-phys
dladm show-link
dladm show-linkprop
dladm show-vnic
dladm show-etherstub
ipadm show-if
ipadm show-ifprop
ipadm show-addr
ipadm show-addrprop
# Solaris 11 - Manual
netadm enable -p ncp DefaultFixed
netcfg
Configure network interface
dladm create-vnic
dladm delete-vnic
dladm rename-link
dladm create-etherstub
Starting and stopping a network ifconfig qfe0 up /sbin/ifup eth0 /sbin/ifup eth0
interface ifconfig qfe0 down /sbin/ifdown eth0 /sbin/ifdown eth0 ifconfig lan0 up
ifconfig lan0 down
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 5 of 11
ndd -set <device> <parm> <value> (dynamically) mii-tool -F 100baseTx-FD eth0 ethtool -s eth1 speed 100 duplex full ndd -set <device> <parm> <value>
/etc/system (edit and update then reboot - permanent) ethtool -s eth1 speed 100 duplex full lanadmin -X <option> lan0
Setting NIC speed
ethtool eth0
ndd -get <device> <parm> mii-tool -v lanadmin -> lan -> display
ethtool eth1 sysctl -a |grep net*
# List parameters ethtool -t eth0 online ## options supported
Change NIC parameters ndd -get /dev/hme \? ndd -get /dev/ip ?
ndd -get /dev/e1000g0 \? sysctl -a | grep net* ndd -get /dev/tcp ?
ndd -get /dev/ip \? ndd -get /dev/arp ?
ndd -get /dev/tcp \? ndd -get /dev/udp ?
# create bonding
/etc/sysconfig/network-scripts/ifcfg-bond0
Test IPMP, Bonding # modprobe
/etc/modprobe.d/bonding.conf
svcprop <pattern>
setup DNS
Note: just use listprop on its own to view all options
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 6 of 11
Boot (jumpstart) servers: Boot (jumpstart) servers: Boot (jumpstart) servers: Boot (jumpstart) servers:
rpcinfo -b bootparam 1 rpcinfo -b bootparam 1 rpcinfo -b bootparam 1 rpcinfo -b bootparam 1
Crash Dump
dumpadm -d <device> diskdump diskdump edit /stand/system sysdumpdev -l (list dump destination)
coreadm netdump netdump sysdumpdev -e (estimates dumpsize)
kdump (part of kexec rpm) kdump (part of kexec rpm) add either: sysdumpdev -L (info)
crash (used to analyse dump 2/0/1.5.0
crash dumps) /etc/kdump.conf (select where you /etc/kdump.conf (select where you dump lvol sysdumpstart -p (start dump primary)
adb (used to analyse want the dump to go) want the dump to go) dump none sysdumpstart -s (start dump secondary)
Crash Dump crash dumps) service kdump start service kdump start
chkconfig kdump on chkconfig kdump on # crash config file # set the dump device permanently
/etc/rc.config.d/savecrash sysdumpdev -p <dump device> -P
## to crash the system ## to crash the system
echo "c" > /proc/sysrq-trigger echo "c" > /proc/sysrq-trigger # analyse dump file
echo "stat\n status\n t -m" | crash /var/adm/ras/vmcore.0
crash (used to analyse crash dumps) crash (used to analyse crash dumps)
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 7 of 11
pstack <pid>
pstop <pid>
ptime <pid>
ptree <pid>
pwait <pid>
pwdx<pid>
modload -p drv/<module name> modprobe <module> modprobe <module> kmadmin -L <module name>
load modules
insmod insmod
modunload -i <module number> modprobe -r <module> modprobe -r <module>
rmmod rmmod kmadmin -U <module name>
unload modules
kmadmin -u <module id>
/etc/system (edit and reboot) /etc/sysctl.conf (edit and update then reboot) /etc/sysctl.conf (edit and update then reboot) kcweb (11i)
sysctl -p <filename> sysctl -p <filename> kctune (11i only)
rebuild kernel (< 11i see below)
sysctl -w param=value sysctl -w param=value
Services
# change or add
svccfg
Service notifications
# verify or confirm
svcprop
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 8 of 11
# Create your
stop/start
# script in /etc/init.d
Patching / Software
rpm -e <package> dpkg -r <package> (do not remove config files) swremove
pkgrm dpkg -P <package> (remove config files)
# NEW IPS
removing packages pkg uninstall< package>
pkgchk -l <package> | grep -i pathname rpm -ql <package> dpkg -L <package> (list files) swlist -l file <product>
# NEW IPS
pkg history
pkg purge-history
pkg freeze
Other package commands
pkg unfreeze
pkg fix
pkg refresh
pkg publisher
/var/sadm /var/lib/rpm /var/lib/dpkg/info /var/adm/sw
Package directory
List libraries required for binary ldd <file> ldd <file> ldd <file> chatr <file>
program
Accounts
useradd
useradd useradd mkuser
create a user # user defaults useradd
system-config-users (GUI) sam useradd
/usr/sadm/defadduser
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 9 of 11
passwd
pwdadm
pwdck -t ALL
create a group groupadd groupadd groupadd groupadd mkgroup <group name>
remove a group groupdel groupdel groupdel groupdel rmgroup <group name>
modify a goup groupmod groupmod groupmod groupmod chgroup <attribute><group name>
/etc/passwd /etc/passwd /etc/passwd /etc/passwd
password files /etc/security/passwd
/etc/shadow /etc/shadow /etc/shadow /tcb/files/auth/r/root (trusted system)
id -a id -a id -a id id
whoami whoami whoami whoami whoami
who who who who who
w w w w w
finger finger finger uptime (displays # of users logged in) uptime (displays # of users logged in)
logins -p finger finger
useful user
commands # License information
lslicense
chlicense
NFS
nfs status ps -ef|grep < nfs daemons> /sbin/service nfs status /etc/init.d/nfs-kernel-server status
nfs reload shareall /sbin/service nfs reload exportfs -rav (export the shares)
nfs performanace nfsstat nfsstat nfsstat
n/a cat /var/lib/nfs/etab cat /var/lib/nfs/etab
nfs Options
NTP
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 10 of 11
ntp daemon options /lib/svc/method/xntp /etc/sysconfig/ntpd /etc/default/ntp /etc/rc.config.d/netdaemons startsrc -s xntpd -a "-x"
/etc/rc.tcpip
Log Files
Security
Misc
Startup options
boot <option> single - use grub to edit kernel line single - use grub to edit kernel line interact with IPL? Y
emergency - use grub to edit kernel line emergency - use grub to edit kernel line
# Options linux rescue - use at the boot prompt linux rescue - use at the boot prompt # single user
-s single user ISL> hpux -is
-a interactive single: runlevel1, local fs mounted, no network single: runlevel1, local fs mounted, no network
-x no device drivers (used in emergency: root fs read-only, no init files run emergency: root fs read-only, no init files run
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018
Unix Commands Page 11 of 11
clustering) rescue: use cd-rom/network, root mounted rescue: use cd-rom/network, root mounted # Logical volume maintanence mode
-r reconfigure devices as /mnt/sysimage as /mnt/sysimage ISL> hpux -lm
-m milestone
# No quroum check
ISL> hpux -lq
• Boot PROM: displays system 1. BIOS 1. BIOS 1. PDC - processor-dependent code; executes and
information, run POST, load 2. POST 2. POST performs self-tests
bootblk, locate ufsboot 3. Master Boot Record (MBR) - point to the 3. Master Boot Record (MBR) - point to the 2. ISL - initial system loader; loads the secondary
• Boot Programs: bootblk loads bootloader GRUB or LILO bootloader GRUB or LILO system loader hpux
and executes the ufsboot 4. GRUB (stage 1) - point to GRUB stage 1_5 4. GRUB (stage 1) - point to GRUB stage 1_5 3. HPUX - is the secondary system loader and loa
• Kernel Initialization: ufsboot 5. GRUB (stage 1_5) - deals with specific 5. GRUB (stage 1_5) - deals with specific the kernel /stand/vmunix, then hands over to
Boot process
loads and executes the core filesystem types look at /boot/grub/*1_5 files filesystem types look at /boot/grub/*1_5 files the kernel
kernel, initializes core kernel 6. GRUB (stage 2) – reads /etc/grub.conf and 6. GRUB (stage 2) – reads /boot/grub/menu.lst 4. KERNEL - swapper processes are started by the
data structures, loads other displays the grub menu, it specifies the kernel and displays the grub menu, it specifies the kernel then starts the init
kernel modules based on and the initrd files kernel and the initrd files 5. INIT - reads /etc/inittab
the /etc/system file, 7. KERNEL - control given to the kernel 7. KERNEL - control given to the kernel
starts /sbin/init program 8. INIT - reads /etc/inittab and 8. INIT - runs the /etc/event.d/rc-default script
• init: starts other processes runs /etc/rc.d/rc.sysinit script
based on the /etc/inittab file
bootadm list-archive
bootadm update-archive
bootadm list-menu
bootadm set-menu <option>
Boot Environments
(BE) beadm create
beadm rename
beadm activate
beadm list
beadm destroy
determine the run who -r runlevel runlevel who -r
level who -r who -r
obtain default run cat /etc/inittab cat /etc/inittab /etc/event.d/rc-default /etc/inittab
level
list locale locale -a locale -a locale -a locale -a
n/a startx (shorthand of below) n/a
start xwindows
initx (lots of parms)
sys-unconfig set_parms [initial|hostname|ip_address|timezone]
initialize system
Note: set_parms is in /sbin
/etc/TIMEZONE /etc/sysconfig/clock /etc/timezone /etc/TIMEZONE
Timezone
/etc/default/init /usr/share/zoneinfo/zone.tab /usr/share/zoneinfo/zone.tab
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/17/2018