You are on page 1of 12

12/17/2016 UnixCommands

CommonUnixCommands
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

Solaris Red Hat Ubuntu/Debian HPUX


cat /etc/release cat /etc/enterpriserelease cat /etc/lsbrelease /stand/kernrel
cat /etc/redhatrelease
lsb_release a
Server Release info lsb_release a

cat /proc/version

/usr/platform/`uname i`/sbin/prtdiag v dmidecode dmidecode


model
Server type
uname a

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

Operating System uname a uname a uname a uname a


/usr/platform/`uname i`/sbin/prtdiag v
prtconf | grep i mem cat /proc/meminfo (detailed) cat /proc/meminfo (detailed) dmesg | grep i physical
free om free om /usr/sam/lbin/getmem
Memory /opt/ignite/bin/print_manifest
cat /proc/slabinfo cat /proc/slabinfo
cat /var/opt/ignite/local/manifest/manifest.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 properti
## display,offline,online
CPU (type, number, etc) psrinfo cat /var/opt/ignite/local/manifest/manifest.info
psradm f 0 (offline)
psradm n 0 (online)

fdisk l fdisk l ioscan funC disk


format sfdisk l (advanced server) sfdisk l (advanced server)
prtvtoc <device> parted <device> print parted <device> print
partprobe s <device> partprobe <device>
format e (to convert EFI (zfs) to SMI)
Disk Drives
smartctl a <device>
Note:
EFI Extensible Firmware Interface
SMI Sun Microsystems Inc

/boot/initrd.?????.img /boot/initrd.img?????server /stand/vmunix


/kernel/genunix /boot/vmlinuz /boot/vmlinuz????server

Kernel File and associated /platform/`uname m`/kernel


directories /platform/i86pc/kernel
/kernel
/usr/kernel

isainfo kv (solaris 9+) uname a uname a


isalist (sparc v9 will be listed first) uname m uname m getconf KERNEL_BITS ( version 11)
isainfo b getconf a |grep i 'long_bit' getconf a |grep i 'long_bit' /opt/ignite/bin/print_manifest |grep i 'os mode
cat /proc/version
HPUX < version 11 all 32 bit
Kernel 32 or 64
Note: determine if system supports 64 bit
getconf HW_CPU_SUPP_BITS
/opt/ignite/bin/print_manifest |grep i 'hw capa

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 1/12
12/17/2016 UnixCommands

At the OK prompt type banner boot into the BIOS (normally F2 or F12) boot into the BIOS (normally F2 or F12)
workstations:
reboot
Display Firmware enter PDC
type: IN (information menu)
type: FV (Firmware Version)

n/a /proc/interrupts /proc/interrupts n/a


Display IRQ, IO ports and DMA /proc/ioports /proc/ioports
/proc/dma /proc/dma
admintool linuxconf linuxconf sam
GUI admin tool

MemoryandSwap

Solaris Red Hat Ubuntu/Debian HP


/usr/platform/`uname cat /proc/meminfo (detailed) cat /proc/meminfo (detailed) prtconf m
i`/sbin/prtdiag v free om free om dmesg | grep i physical prtconf |grep i memory
prtconf | grep i mem /usr/sam/lbin/getmem lsattr El sys0 a realmem
Memory /opt/ignite/bin/print_manifest bootinfo r

cat /var/opt/ignite/local/manifest/manifest.info

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 pag
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 re
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 attribute
chlv n <new name> <old old> (chang
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 rest
s size of the page space (logical part
n activiates the paging space (use sw

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 deactivia

Disks,FilesystemsandDevices

Solaris Red Hat Ubuntu/Debian


fdisk l ioscan funC disk
format fdisk l sfdisk l (advanced server)
prtvtoc <device> sfdisk l (advanced server) parted <device> print
cfgadm al parted <device> print partprobe <device>
fcinfo hbaport partprobe <device>
luxadm probe
mpathadm list initiatorport udevadm info q all n /dev/sda1
mpathadm show <initiatorport name> blkid
Disk Drives iscsiadm list initiatornode dmsetup [ls|info]
iscsiadm list discovery

format e (to convert EFI (zfs) to SMI)

Note:
EFI Extensible Firmware Interface
SMI Sun Microsystems Inc

format hdparm i /dev/hda hdparm i /dev/hda


iostat En hdparm I /dev/hda (detailed) hdparm I /dev/hda (detailed) diskinfo v /dev/rdsk/c0t4d0 (d
luxadm inq <disk> (A5x00 disk arrays) number)
hdparm Tt /dev/hda (speed test) haparm Tt /dev/hda (speed test) /opt/ignite/bin/print_manifest

sdparm i /dev/sdb sdparm i /dev/sdb ## Insure that the online diagn


have been installed
cat /proc/ide/ide0/hda/model cat /proc/ide/ide0/hda/model swlist l bundle | grep 'Suppor
Disk serial Number, type, cat /proc/scsi/scsi cat /proc/scsi/scsi
etc ## CommandLine Support Tool
## The run cstm
cstm
cstm> map
cstm> sel dev 4 (select the
cstm> info
cstm> il(obtain th
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
Logical Interchange Format (LIF

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 2/12
12/17/2016 UnixCommands
a file system. For a device to b
volume on that device must co
(the initial system loader) and
bootstrap utility) LIF files. ISL i

use format to partition the disk then just use mknod /dev/rawctl c 162 0 Just create a new LVOL withou
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
## map raw devices to the disk
List Raw Partitions ## New way, Edit below file raw /dev/raw/raw1 /dev/sdb1
/etc/udev/rules.d/60raw.rules
udevinfo d or udevadm info ## display raw devices
raw qa
## Display raw partitions
raw qa

format (use analyse ) badblocks badblocks dd if=/dev/rdsk/cXtYd0 of=/de


Bad Blocks
Note: no errors means disk is g
df k df k df k bdf
Filesystem commands df h df h df h df [egiklnvfb]

newfs v <raw device> mkfs t ext3 /dev/sdb1 newfs F vxfs o largefiles /dev
mkfs t ext3 /dev/sdb1
# Display how the filesystem was created mke2fs t ext4 /dev/sdb1 mkfs F vxfs o largefiles /dev/
newfs Nv <filesystem>
# all point to mke2fs Note: mkfs and newfs are a poi
mkfs.ext2 /sbin/fs_wrapper
mkfs.ext3
mkfs.ext4
Filesystem (create|remove)
cat /etc/mke2fs.conf

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'
# Look at the second line to se
fstyp v <filesystem> | grep fsclean
tune2fs l /dev/sdb<?> |grep i 'filesystem state' # needs checking
# edit /etc/default/rcS change below so
tunefs v <filesystem>
# you dont have to hang around
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

setenv bootdevice [<device>|<alias>] /boot/grub/menu.lst setboot p <primary path>


eeprom bootdevice [<device>|<alias>] /boot/grub/grub.conf setboot a <alternate path>
Setting the boot device /etc/lilo.conf
# autoboot sequnce
setboot b [on|off]

installboot /usr/platform/`uname grubinstall <rawdevice> grubinstall <rawdevice> mkboot l <device>


Creating boot device (MBR) i`/lib/fs/ufs/bootblk <rawdevice> lilo v
Note: we are treating the disk
fdformat v U floppy probe (use device obtained below ) n/a n/a
volcheck v floppy createrc > /etc/fd0
Format floppy drive
newfs v /vol/disk/aliases/floppy0 floppy format /dev/fd0
mkfs /dev/fd0
volrmmount l floppy0 mount /dev/fd0 /mnt/floppy n/a n/a
mount/unmount floppy
eject floppy umount /mnt/floppy
mount F hsfs o ro <device path> mount rt iso9660 /dev/cdrom /mnt/cdrom
/cdrom/cdrom0 mount rt iso9660 /dev/cdrom /mnt/cdrom umount /mnt/cdrom mount rF cdfs /dev/dsk/c1t6d
umount /cdrom/cdrom0 umount /mnt/cdrom eject cdrom
mount/unmount CDROM eject cdrom start: /usr/sbin/pps_mountd
/etc/init.d/volmgr start pps_mount
eject cdrom

lofiadm a <iso image> /dev/lofi/1
mount F hsfs o ro /dev/lofi/1 /mnt
mount/umount ISO image
# to list
lofiadm

n/a mount o remount,rw / mount o remount,rw / mount_vxfs o remount,ro <file

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 3/12
12/17/2016 UnixCommands
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
recovery tape
/opt/ignite/bin/make_recovery
ok> boot cdrom s using the grub window append the word single using the grub window append the word single enter PDC
to the kernel line to the kernel line > search
>boot p1 (cdrom)
interact with IPL? Y
boot cdrom/diskette (single ISL> hpux is
user)

ok> boot as f10 or f12 f10 or f12 >boot pri


interact with IPL? Y
ISL> hpux lm

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

drvconfig /dev/MAKEDEV <device> /dev/MAKEDEV <device>


devlinks insf C tape (Class)
update /dev directory disks|tapes|ports
insf H 0.1.0 e (recreate delet
devfsadm ( solaris 8, 9, 10)

rem_drv # remove all devices from a ha


rmsf k H 52.6.0
remove or change a device

prtconf D cat /proc/devices cat /proc/devices lsdev


sysdef

list device drivers

Networking

Solaris Red Hat Ubuntu/Debian


Basic network information /etc/hostname.hme0 /etc/sysconfig/network /etc/network/interfaces /etc/rc.config.d/netcon
(hostname, ip address) /etc/sysconfig/networkscripts/ifcfgeth0
ifconfig ifconfig ioscan funC lan (list ha
prtdiag v systemconfignetwork (GUI) lanscan v (list configur
ifconfig a ifconfig lan0 (individual

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

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 4/12
12/17/2016 UnixCommands
ifconfig ifconfig ifconfig ifconfig <interface>

# 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

ifconfig qfe0 up /sbin/ifup eth0 /sbin/ifup eth0


ifconfig qfe0 down /sbin/ifdown eth0 /sbin/ifdown eth0 ifconfig lan0 up
ifconfig lan0 down
Starting and stopping a network
interface
note: there is no "ifcon
then "ifconfig <interface

ndd set <device> <parm> <value> (dynamically) miitool F 100baseTxFD eth0 ethtool s eth1 speed 100 duplex full ndd set <device> <parm
/etc/system (edit and update then reboot permanent) ethtool s eth1 speed 100 duplex full lanadmin X <option> la
Setting NIC speed

ethtool eth0
ndd get <device> <parm> miitool v lanadmin > lan > displ
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 ?

netstat i [I interface]
Display NIC statistics netstat s

ifconfig a (as user root) ifconfig ifconfig lanscan


display MAC address
systemconfignetwork (GUI)
snoop d <interface>
tcpdump i <interface> tcpdump i <interface> nettl start
nettl status all
ethereal (needs to be installed) ethereal (needs to be installed) nettl tn pduin pduout
Displaying network packets /var/adm/LAN
nettl stop

use netfmt to display t

/etc/defaultrouter edit /etc/network/interfaces /etc/rc.config.d/netcon


edit /etc/sysconfig/network
default router route add default <gateway> add: gateway <IP address>
route p add default <gateway> (persist changes) add: GATEWAY=<IP address>

netstat rn netstat rn netstat rn netstat rn


display routing table route n route n

You buy an optional pro


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)

tail /var/adm/messages cat /proc/net/bonding/bond0 cat /proc/net/bonding/bond0

# 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

/etc/sysconfig/network /etc/hostname set_parms hostname (re


change the following files: /etc/hosts /etc/hosts

/etc/nodename sysctl a |grep hostname sysctl a |grep hostname


/etc/hostname.<interface>
/etc/inet/hosts
/etc/inet/ipnodes
/etc/net few files in here as well
change the hostname
# Solaris 11
svccfg s system/identity:node listprop config/nodename

svcfg s system/identity:node setprop config/nodename =


astring: hostname
svcadm refresh system/identity:node
svcadm restart indentity:node

/etc/resolv.conf /etc/resolv.conf /etc/resolv.conf

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/12
12/17/2016 UnixCommands
/etc/resolv.conf

# 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

setup DNS svcprop <pattern>

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

/etc/nsswitch.conf /etc/nsswitch.conf /etc/nsswitch.conf


/etc/nsswitch.conf /etc/host.conf /etc/host.conf /etc/resolv.conf
/etc/resolv.conf /etc/resolv.conf /etc/resolv.conf
Name service switch file (DNS
client) # Solaris 11 you need to use the svccfg command
see above

svcadm restart system/nameservicecache:default ## if installed n/a


Flush DNS cache
service nscd restart
/etc/defaultdomain /etc/sysconfig/network (HOSTNAME option) /etc/host /etc/rc.config.d/netcon
/etc/resolv.conf /etc/resolv.conf
Domain Name
Note: for NIS use the NISDOMAIN option
route n get <hostname> ip route get <IP address> ip route get <IP address> n/a
Obtain IP Address routing
traceroute traceroute traceroute

Boot (jumpstart) servers: Boot (jumpstart) servers: Boot (jumpstart) servers: Boot (jumpstart) server
rpcinfo b bootparam 1 rpcinfo b bootparam 1 rpcinfo b bootparam 1 rpcinfo b bootparam 1

NFS servers: NFS servers: NFS servers: NFS servers:


Find Services on the network rpcinfo b mountd 1 rpcinfo b mountd 1 rpcinfo b mountd 1 rpcinfo b mountd 1

NIS servers/slaves: NIS servers/slaves: NIS servers/slaves: NIS servers/slaves:


rpcinfo b ypserv 1 rpcinfo u <yp server> ypserv rpcinfo u <yp server> ypserv rpcinfo b ypserv 1

CrashDump

Solaris Red Hat Ubuntu/Debian HP AIX

dumpadm d diskdump diskdump edit /stand/system sysdumpdev l (list dump destination)


<device> netdump netdump sysdumpdev e (estimates dumpsize)
coreadm kdump (part of kexec rpm) kdump (part of kexec rpm) add either: sysdumpdev L (info)
dump 2/0/1.5.0
crash (used to /etc/kdump.conf (select where you /etc/kdump.conf (select where you dump lvol sysdumpstart p (start dump primary)
analyse crash dumps) want the dump to go) want the dump to go) dump none sysdumpstart s (start dump secondary)
Crash Dump adb (used to analyse service kdump start service kdump start
crash dumps) 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/sysrqtrigger echo "c" > /proc/sysrqtrigger # 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)

PerformanceMonitoringandDiagnostics

Solaris Red Hat Ubuntu/Debian HP AIX


top (sunfreeware) top top top
prstat sar sar sar topas P
sar mpstat mpstat w (load average) topas L(logical partitions)
mpstat w (load average) w (load average) uptime (load average) mpstat
w (load average) uptime (load average) uptime (load average) ps sar c
uptime (load average) ps ps vmstat w (load average)
CPU ps vmstat vmstat glance uptime (load average) CPU
vmstat procinfo procinfo sam lparstat
oprofile cat /proc/cpuinfo ps
cat /proc/cpuinfo iostat tT 1
tprof
curt

prstat free free top topas


vmstat vmstat vmstat vmstat vmstat
top top top sar sar b
sar procinfo procinfo sam svmon
Memory Memory
slabtop slabtop glance ps
sar sar ipcs a
cat /proc/meminfo cat /proc/meminfo lockstat (version 4)
rmss
ndd ethtool ethtool netstat [ent|tok|fddi|atm]stat
netstat miitool miitool lanadmin netstat
lsof netstat netstat sam netpmon (trcstop to stop
snoop lsof lsof glance trace)
Network Network I/O
route tcpdump tcpdump
ip ip
iptraf iptraf
nmap

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 6/12
12/17/2016 UnixCommands
sar d sar d sar d iostat topas D(disk)
iostat iostat iostat sar topas F(filesystem)
vmstat vmstat vmstat sam iostat
lsof lsof lsof glance sar D
fcstat (fibre)
Disk lvmstat Disk I/O
filemon (trcstop to stop)
fileplace

# 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>

NFS nfsstat nfsstat nfsstat nfsstat nfsstat NFS


top
prstat
ps ef
pargs <pid>
pcred <pid>
pfiles <pid>
pflags <pid>
pgrep <pattern>
pkill <pattern>
pmap <pid>
Process
pldd <pid>
preap <pid>
prun <pid>
psig <pid>
pstack <pid>
pstop <pid>
ptime <pid>
ptree <pid>
pwait <pid>
pwdx<pid>

KernelModulesandParameters

Solaris Red Hat Ubuntu/Debian HP


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 modules /lib/modules/`uname r`/kernel/drivers
Config:
Config: /etc/modprobe.d/options
/etc/modprobe.conf /etc/modprobe.d
/etc/modprobe.d

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

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.............................................

cat /etc/system sysctl a sysctl a kctune (11i only)


sysdef i cat /etc/sysctl.conf cat /etc/sysctl.conf sysdef
display kernel kmtune
parameters cat /proc/sys/kernel/sem cat /proc/sys/kernel/sem kmsystem
cat /proc/sys/kernel/shmmax cat /proc/sys/kernel/shmmax /usr/sam/lbin/getkinfo f /stand/vmunix o
etc................................... etc................................... /tmp/kernel.data
cd /usr/src/linux2.5
edit and update file then reboot: edit Makefile (change EXTRAVERSION) cd /stand/build
/etc/system make mrproper /usr/lbin/sysadm/system_prep v s system
backup .config edit system file
make xconfig /usr/sbin/mk_kernel s ./system
make dep mv /stand/system /stand/system.old
build kernel mv /stand/vmunix /stand/vmunix.old
make bzImage
make modules mv /stand/build/system /stand
move new kernel mv /stand/build/vmunix_test /stand/vmunix
make modules_install reboot
change lilo/grub config file
reboot
interprocess ipcs a ipcs a ipcs a ipcs a
communication

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 7/12
12/17/2016 UnixCommands
Services

Solaris Red Hat Ubuntu/Debian HP AIX


service statusall There is no services or chkconfig There is no services or chkconfig lssrc a
svcs a command use the old fashioned way command
svcs l <service> /etc/init.d/<service> use the old fashioned way
display services
svcs vx /sbin/init.d/<service>
inetadm l

svcadm enable nfs service nfs start startsrc s <subsystem>


start services
startsrc g <group>
svcadm disable nfs service nfs stop stopsrc s <subsystem>
stop services
stopsrc g <group>
svcadm refresh nfs service nfs reload refresh s <subsystem>
reload service
svcadm clear nfs (changes state)
svcadm restart nfs service nfs restart stopsrc s <subsystem>
restart service
startsrc s <subsystem>
service status svcs nfs service nfs staus lssrc a
service dependencies svcs d network n/a n/a
service dependants svcs D network n/a n/a

# change or add
svccfg
Service notifications
# verify or confirm
svcprop

/var/svc/log n/a /var/adm/ras


/var/svc/manifest /etc/syslog.conf
service logging, etc /lib/svc/method /etc/rc.tcpip
/etc/svc/repository.db
/system/volatile/svc_nonpersist.db
change service n/a chkconfig levels 2345 n/a
startup nfs on
n/a
# Create your
stop/start
Add a new service # script in /etc/init.d

chkconfig add <script>

Patching/Software

Solaris Red Hat Ubuntu/Debian HP


showrev p swlist l bundle
display installed patches patchadd p swlist l product
swlist l patch
patchadd patch p1 <patch>
patchadd M <dir> (multiple patches)
zcat patch46.gz | patch p1 swcopy (install patch into depot)
adding patch swinstall (install patch from depot)
Note: p = # of path stripping
Note: the swagentd daemon must b

removing patch patchrm patch R p1 <patch> swremove


pkginfo (all packages) rpm qa (all packages) dpkg l swlist l bundle <bundle>
pkginfo l (single package) rpm q (single package) dpkg S <search string> (search) swlist l product <product>
pkgchk l p <file> (file belongs) rpm qf (file belongs) dpkg S <filename> (file belongs)
rpm qi <package> (very detailed) dpkg s <package> (status) ## check a package
# NEW IPS dpkg p <package> (detailed) swlist s <full_path/software>
pkg list (all packages)
pkg info (single package)
display installed packages pkg search (find packages and files)

pkgadd rpm Uhv (updates/installs if not already) dpkg i <package> swinstall


rpm ihv (install) swinstall s <full_path/software>
# NEW IPS
adding package pkg install
pkg update

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>

rpm V <package> n/a swverity <fileset> (see


pkginfo l /var/adm/sw/swagent.log)
pkginfo p
verify package
# NEW IPS
pkg publisher
pkg verify <package>

pkgchk l <package> | grep i pathname rpm ql <package> dpkg L <package> (list files) swlist l file <product>

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 8/12
12/17/2016 UnixCommands
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

List libraries required for binary ldd <file> ldd <file> ldd <file> chatr <file>
program

Accounts

Solaris Red Hat Ubuntu/Debian HP AIX


cat /etc/passwd cat /etc/passwd cat /etc/passwd cat /etc/passwd cat /etc/passwd
display users systemconfigusers (GUI) logins x
logins x [p] lsuser f ALL (detailed)

useradd
useradd useradd mkuser
create a user # user defaults useradd
systemconfigusers (GUI) sam useradd
/usr/sadm/defadduser

userdel userdel rmuser


remove a user userdel userdel
systemconfigusers (GUI) sam userdel
chuser a
usermod
usermod usermod passwd f
modify a user usermod usermod
systemconfigusers (GUI) sam passwd s
chfn <username>
chfn <username><shell>
passwd
change user
passwd passwd passwd passwd pwdadm
password
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

# 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

Solaris Red Hat Ubuntu/Debian


server: mountd, nfsd server: rpc.mountd,nfsd
client: statd, lockd client: rpc.statd, lockd server: rpc.mountd,nfsd
NFS Daemons
client: rpc.statd, lockd

/etc/dfs/dfstab /etc/exports /etc/exports


NFS files /etc/dfs/sharetab /var/lib/nfs/etab /var/lib/nfs/etab
/etc/rmtab /var/lib/nfs/xtab /var/lib/nfs/xtab
/etc/rmtab /var/lib/nfs/rmtab /var/lib/nfs/rmtab
List nfs clients that have a remote mount

dfshares showmount e localhost showmount e localhost


display nfs shares
showmount e localhost
/etc/dfs/dfstab (edit and add share) redhatconfignfs (GUI) /etc/exports (edit and add share, see below example)
share <path> exportfs rav (export the shares)
/etc/exports (edit and add share)
## dfstab example /sbin/service nfs reload /etc/init.d/portmap restart
create nfs share
share F nfs d "jumpstart" /etc/init.d/nfskernelserver restart
/export/jumpstart ## /etc/exports example
/export *(rw,fsid=0,insecure,no_root_squash,sync) ## /etc/exports example
/export *(rw,fsid=0,insecure,no_root_squash,sync)
unshare <path> /etc/exports (edit and remove share) /etc/exports (edit and remove share)
/etc/dfs/dfstab (edit and remove share) /sbin/service nfs reload exportfs rav (export the shares)

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 9/12
12/17/2016 UnixCommands
uncreate nfs share

/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

/etc/init.d/nfs.server stop /sbin/service nfs stop /etc/init.d/portmap stop


/etc/init.d/nfs.client stop /etc/init.d/nfskernelserver stop
stop nfs daemons

nfs status ps ef|grep < nfs daemons> /sbin/service nfs status /etc/init.d/nfskernelserver 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

## Make sure you use NFS version 3 n/a n/a


solaris/redhat mount problems (nfs v3 to
mount F nfs o vers=3 <mount>
v4)
<mountpoint>

NTP

Solaris Red Hat Ubuntu/Debian HP


ntpd xntpd xntpd
Time daemons xntpd ntpd

/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.conf
/etc/ntp.conf dateconfig (GUI) /etc/ntp.conf
/etc/ntp.server startsrc s xntpd
/etc/ntp.client chkconfig list ntpd /etc/init.d/ntp [start|stop|restart] stopsrc s xntpd
chkconfig level 2345 ntpd on
/etc/rc2.d/xntpd [start|stop] /sbin/service ntpd start lslpp L all|grep
ntp setup
# Solaris 10
/etc/inet/ntp.server
/etc/inet/ntp.client

svcadm enable ntpd

/lib/svc/method/xntp /etc/sysconfig/ntpd /etc/default/ntp /etc/rc.config.d/netdaemons


startsrc s xntpd
ntp daemon options
/etc/rc.tcpip

ntpq p ntpq p ntpq p ntpq p ntpq p


NTP Trace commands ntptrace ntptrace ntptrace ntpdate (set the date) ntptrace
ntpdate

LogFiles

Solaris Red Hat Ubuntu/Debian HP AIX


messages /var/adm/messages /var/log/messages /var/log/messages /var/adm/syslog/syslog.log /var/adm/ras messages
syslog /var/log/syslog /var/log/syslog /var/log/syslog /var/adm/syslog/syslog.log /var/adm/ras syslog
mail /var/log/mail /var/log/mail.* /var/adm/syslog/mail.log /usr/spool/mqueue/syslog mail
cron /var/cron/log /var/log/cron /var/log/cron.log /var/adm/cron/log /var/adm/cron/log cron
/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)
errpt a (detailed errorlog report)
Error logging logger logger logger logger Error logging
errpt j <identifier> (single errorlog report)

errclear (clears errorlog)


errclear d <class><days> (clears class errors)

errlogger "message upto 230 chars"

Security

Solaris Red Hat Ubuntu/Debian HP AIX


pwdck t ALL
Checking the passwd file pwck pwck pwck pwck
usrck t ALL
checking the group file grpck grpck grpck grpck grpck
# No reboot required # No reboot required # No reboot required
# Solaris 10 (no reboot) /etc/securetty /etc/securetty /etc/security/user
/etc/default/login # No reboot required
/etc/securetty chsec f /etc/security/user s root
# Solaris 11 (no reboot)

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 10/12
12/17/2016 UnixCommands
console login (allow/deny) /etc/default/login Note: you may need to create this
/etc/user_attr (see below) file if it does not exist

rolemod K type=normal root

Misc

Solaris Red Hat Ubuntu/Debian HP


grub (GUI) grub (GUI) setboot p <primary path>
eeprom lilo (text based) setboot a <alternate path>
startup
setenv bootdevice # autoboot sequnce
setboot b [on|off]
shutdown h (halt) shutdown h now (halt)
shutdown i5 g0 y (power down) shutdown r (reboot) shutdown h (halt) shutdown r now(reboot)
shutdown i6 g0 y (reboot) shutdown f (fast reboot no fsck) shutdown r (reboot)
shutdown i0 g0 y (OK prompt) shutdown F (force fsck) shutdown P (power off)

shutdown reboot r (reboot/reconfigure) touch /forcefsck

touch /reconfigure # edit /etc/default/rcS change below so


# you dont have to hang around
FSCKFIX=yes

halt halt halt init


init init init reboot
poweroff poweroff poweroff shutdown
Change run level reboot reboot reboot
shutdown shutdown shutdown
telinit telinit telinit
uadmin
init status
0 0 halt
1 0 shutdown 0 halt 1 single user 0 halt
2 1 single user 1 single user 2 multiuser (default) 1 single users
3 2 n/a 2 multiuser (no networking) 3 same as 2 2 multiuser (networking)
4 3 Multiuser 3 multiuser (networking) 4 same as 2 3 multiuser (networking, NFS, and CD
5 4 n/a 4 unused 5 same as 2 4 multiuser (netwrking, NFS, and VUE
6 5 power off 5 GUI 6 reboot 5 n/a
6 reboot 6 reboot 6 n/a


# 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

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
Startup options x no device drivers (used in emergency: root fs readonly, no init files run emergency: root fs readonly, no init files run # Logical volume maintanence mode
clustering) rescue: use cdrom/network, root mounted as rescue: use cdrom/network, root mounted as ISL> hpux lm
r reconfigure devices /mnt/sysimage /mnt/sysimage
m milestone # No quroum check
ISL> hpux lq

/etc/init.d /etc/init.d /etc/init.d /sbin/init.d


/etc/rc.config.d (startup config files)
/etc/rc0.d /etc/rc6.d /etc/rc0.d /etc/rc6.d /etc/rc0.d /etc/rc6.d
/sbin/rc0.d /sbin/rc6.d
startup scripts

F10 or F12 F10 or F12 interact with IPL? Y


boot
printenv
setenv
banner
devalias
boot prompt showdevs
commands showpcidevsall
probescsiall
probefcalall
probepci
watchnetall
resetall

Phases: Boot sequence Boot sequence Phases:

Boot PROM: displays system 1. BIOS 1. BIOS 1. PDC processordependent cod


information, run POST, load 2. POST 2. POST performs selftests
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
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
Kernel Initialization: ufsboot 5. GRUB (stage 1_5) deals with specific 5. GRUB (stage 1_5) deals with specific loads the kernel /stand/vmunix
Boot process
loads and executes the core filesystem types look at /boot/grub/*1_5 files filesystem types look at /boot/grub/*1_5 over to the kernel
kernel, initializes core kernel 6. GRUB (stage 2) reads /etc/grub.conf and files 4. KERNEL swapper processes are
data structures, loads other displays the grub menu, it specifies the 6. GRUB (stage 2) reads /boot/grub/menu.lst kernel then starts the
kernel modules based on the kernel and the initrd files and displays the grub menu, it specifies the 5. INIT reads /etc/inittab
/etc/system file, starts 7. KERNEL control given to the kernel kernel and the initrd files
/sbin/init program 8. INIT reads /etc/inittab and runs 7. KERNEL control given to the kernel
init: starts other processes /etc/rc.d/rc.sysinit script 8. INIT runs the /etc/event.d/rcdefault
based on the /etc/inittab file script

http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 11/12
12/17/2016 UnixCommands
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_addres
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 12/12

You might also like