Common Unix Commands: Sysinfo
Common Unix Commands: Sysinfo
Common Unix Commands
Sysinfo Display system information i.e cpu, memory, etc
Memory and Swap Information regarding the physical memory and swap area
Disks, Filesystems and Devices Displaying disk information, filesystems
Networking Display and configuring network parameters
Crash Dump Configure, display and use the crash dump utiltities
Performance Monitoring and Diagnostics List, Monitor and trace processes
Kernel Modules and Parameters Displaying, modifying and tuning kernel parameters
Services Display, start and stop services
Patching / Packages Installing and removing patches and software packages
Accounts Setting up and removing user accounts
NFS Information on NFS i.e starting, stopping, etc
NTP Network Time Protocol
Log Files Location to common log files
Security Security information
Misc Other stuff i.e shutdown, timezone, run level, etc
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
cat /proc/cpuinfo (detailed) cat /proc/cpuinfo (detailed)
/usr/platform/`uname i`/sbin/prtdiag v /opt/ignite/bin/print_manifest
sam > performance monitors > system pro
## display,offline,online
CPU (type, number, etc)
psrinfo cat /var/opt/ignite/local/manifest/manifest.info
psradm f 0 (offline)
psradm n 0 (online)
Kernel File and associated /platform/`uname m`/kernel
directories /platform/i86pc/kernel
/kernel
/usr/kernel
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 1/11
29/07/2016 Unix Commands
Memory and Swap
also see /etc/swapspaces file
update /etc/vfstab swapoff <device>|<file> swapoff <device>|<file> remove entry from /etc/fstab swapoff /dev/paging00
removing swap d reboot rmps paging00
swap Remove device or file as normal Remove device or file as normal
Note: paging space must be deac
Disks, Filesystems and Devices
format e (to convert EFI (zfs) to SMI)
Note:
EFI Extensible Firmware Interface
SMI Sun Microsystems Inc
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 /etc/fstab
Disk disk partitions
Note: Boot programs are s
Logical Interchange Forma
file system. For a device to
volume on that device mus
(the initial system loader) a
bootstrap utility) LIF files. I
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 2/11
29/07/2016 Unix Commands
## Display raw partitions raw qa
raw qa
tunefs tunefs v <filesystem>
fstyp v <device> |grep i minfree tune2fs tune2fs vxtunefs v <filesystem>
tune2fs l /dev/sda1 tune2fs l /dev/sda1 fstyp v <filesystem>
Tune Filesystems # change reserved blocks percentage to 1% # change reserved blocks percentage to 1% # Disk fragmentation
tune2fs m 1 /dev/sda1 tune2fs m 1 /dev/sda1 fsadm F vxfs E / (report)
fsadm F vxfs e / (defrag)
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 t
tune2fs l /dev/sdb<?> |grep i 'filesystem state' # needs checking
# edit /etc/default/rcS change below so
# 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 bootdevice 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
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 3/11
29/07/2016 Unix Commands
boot into maintenace mode
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
cdrom: cdrom: cdrom:
/dev/scd0 (external usb cd)
/dev/hda (depends on number of IDE disks) /dev/hda (depends on number of IDE disks) /dev/dsk/c1t6d0
rem_drv # remove all devices from
rmsf k H 52.6.0
remove or change a device
list device drivers
Networking
kstat hme:0:parameters:<param name>
kstat e1000g:0:parameters:<param name>
module:instance:name:statistics
# Solaris 11
netadm list
displaying network interfaces
dladm showphys
dladm showlink
dladm showlinkprop
dladm showvnic
dladm showetherstub
ipadm showif
ipadm showifprop
ipadm showaddr
ipadm showaddrprop
# Solaris 11 Automatic (using profiles)
netadm enable p ncp Automatic
netcfg (use by Automatic)
# Solaris 11 Manual
netadm enable p ncp DefaultFixed
netcfg
Configure network interface
dladm createvnic
dladm deletevnic
dladm renamelink
dladm createetherstub
ipadm createip net1
ipadm createaddr T static a 192.168.0.110/24 net1/pfv
ipadm deleteip
ipadm deleteaddr
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 4/11
29/07/2016 Unix Commands
ethtool eth0
ndd get <device> <parm> miitool v lanadmin > lan >
ethtool eth1 sysctl a |grep net*
# List parameters ethtool t eth0 online ## options support
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
netstat i [I interfa
Display NIC statistics netstat s
use netfmt to displ
You buy an optiona
if_mpadm d (detach) ifenslave d bond0 eth1 (detach) ifenslave d bond0 eth1 (detach) Aggragation.
if_mpadm r (reattach) ifenslave bond0 eth1 (reattach) ifenslave bond0 eth1 (reattach)
# create bonding
/etc/sysconfig/networkscripts/ifcfgbond0
Test IPMP, Bonding # modprobe
/etc/modprobe.d/bonding.conf
# for bonding options use BONDING_OPTS
/etc/sysconfig/networkscripts/ifcfgbond0
# see bonding mode
cat /sys/class/net/bond0/bonding/mode
svcfg s system/identity:node setprop config/nodename =
astring: hostname
svcadm refresh system/identity:node
svcadm restart indentity:node
# Solaris 11 You need to use the svccfg command
svccfg s dns/client listprop config/nameserver
svccfg s dns/client listprop config/search
svccfg s nameservice/switch listprop config/host
svccfg s nameservice/switch listprop config/password
svcprop <pattern>
setup DNS
Note: just use listprop on its own to view all options
svccfg s "dns/client" setprop "config/nameserver =
net_address: (192.168.0.1)"
svccfg s "dns/client" setprop 'config/domain = astring:
("datadisk.co.uk")'
svccfg s "nameservice/switch" setprop 'config/host =
astring: "file dns"'
svcadm refresh nameservice/switch
svcadm refresh dns/client
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/11
29/07/2016 Unix Commands
rpcinfo b bootparam 1 rpcinfo b bootparam 1 rpcinfo b bootparam 1 rpcinfo b bootpara
Crash Dump
Performance Monitoring and Diagnostics
# disk stat history
chdev l sys0 a iostat=true
lsattr HEl sys0 a iostat
truss p <pid> strace p <pid> strace p <pid> download and install tusc
ppriv D e <command> topas
tusc p <pid> truss
sar
Application Application
probevue
tprof
svmon P <pid>
Kernel Modules and Parameters
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 6/11
29/07/2016 Unix Commands
modinfo cat /proc/modules (more detailed) cat /proc/modules (more detailed) kmadmin k
lsmod lsmod
modinfo <module>
Location:
Location: /lib/modules/`uname r`/kernel/drivers
display loaded
/lib/modules/`uname r`/kernel/drivers
modules
Config:
Config: /etc/modprobe.d/options
/etc/modprobe.conf /etc/modprobe.d
/etc/modprobe.d
No reboot (dynamically): No reboot (dynamically):
echo "250 32000 100 28" > /proc/sys/kernel/sem echo "250 32000 100 28" > /proc/sys/kernel/sem
echo "536870912" > /proc/sys/kernel/shmmax echo "536870912" > /proc/sys/kernel/shmmax
set kernel parameters
echo "4096" > /proc/sys/kernel/shmmni echo "4096" > /proc/sys/kernel/shmmni
(tuning)
echo "2097152" > /proc/sys/kernel/shmall echo "2097152" > /proc/sys/kernel/shmall
etc............................................. etc.............................................
Services
Patching / Software
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 7/11
29/07/2016 Unix Commands
patchadd patch p1 <patch>
patchadd M <dir> (multiple patches)
zcat patch46.gz | patch p1 swcopy (install patch into depo
adding patch swinstall (install patch from dep
Note: p = # of path stripping
Note: the swagentd daemon m
List files in package # NEW IPS
pkg contents <package>
# NEW IPS
pkg history
pkg purgehistory
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
Accounts
useradd
useradd useradd mkuser
create a user useradd
# user defaults systemconfigusers (GUI) sam useradd
/usr/sadm/defadduser
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 8/11
29/07/2016 Unix Commands
lslicense
chlicense
# Maximum number of processes for a user
lsattr D l sys0 a maxuproc
chdev l sys0 a maxuproc=<number>
groups groups groups groups groups
useful group
setpgrp setprivgrp setgroups
commands
newgrp lsgroup ALL
/etc/security/policy.conf /etc/login.defs
Password Policy
/etc/default/passwd
passwd chage l <user>
Password Aging
chage <options> <user>
NFS
/sbin/service nfs start /etc/init.d/portmap start
/etc/init.d/nfs.server start /etc/init.d/nfskernelserver start
/etc/init.d/nfs.client start
start/change nfs daemons
svcadm enable nfs/server
svcadm disable nfs/server
NTP
/etc/rc.config.d/netdaemons (set XNTPD to 1)
# Solaris 8 /etc/ntp.conf (edit with ntp servers) /etc/default/ntp /etc/ntp.conf /etc/ntp.con
/etc/ntp.conf dateconfig (GUI) /etc/ntp.conf
/etc/ntp.server startsrc s x
/etc/ntp.client chkconfig list ntpd /etc/init.d/ntp [start|stop|restart] stopsrc s xn
chkconfig level 2345 ntpd on
/etc/rc2.d/xntpd [start|stop] /sbin/service ntpd start lslpp L all|g
ntp setup
# Solaris 10
/etc/inet/ntp.server
/etc/inet/ntp.client
svcadm enable ntpd
Log Files
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 9/11
29/07/2016 Unix Commands
/var/adm/ras
/var/adm/messages /var/log/boot /var/log/boot /var/adm/syslog/syslog.log
boot alog o t boot boot
dmesg dmesg dmesg dmesg
alog o t console
alog L (list all the logs available)
/usr/lib/errdemon l (display attributes)
/usr/lib/errdemon (start error logging)
/usr/lib/errstop (stop error logging)
# use with above errorlog file
errpt (summary errorlog report)
Error errpt a (detailed errorlog report)
logger logger logger logger Error logging
logging errpt j <identifier> (single errorlog report)
errclear (clears errorlog)
errclear d <class><days> (clears class errors)
errlogger "message upto 230 chars"
Security
Misc
touch /reconfigure # edit /etc/default/rcS change below so
# you dont have to hang around
FSCKFIX=yes
# change default change all the telinit
# change default # change default # change default change the
vi /etc/event.d/rcdefault
vi /etc/inittab vi /etc/inittab vi /etc/inittab
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 10/11
29/07/2016 Unix Commands
banner
devalias
boot prompt showdevs
commands showpcidevsall
probescsiall
probefcalall
probepci
watchnetall
resetall
bootadm listarchive
bootadm updatearchive
bootadm listmenu
bootadm setmenu <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/rcdefault /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)
sysunconfig set_parms [initial|hostname|ip_add
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 11/11