Unix Commands
Unix Commands
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
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
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)
MemoryandSwap
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
Disks,FilesystemsandDevices
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 /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
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
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
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 3/12
12/17/2016 UnixCommands
remount a filesystem
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
Networking
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 Manual
netadm enable p ncp DefaultFixed
netcfg
Configure network interface dladm createvnic
dladm deletevnic
dladm renamelink
dladm createetherstub
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
# create bonding
/etc/sysconfig/networkscripts/ifcfgbond0
Test IPMP, Bonding
# modprobe
/etc/modprobe.d/bonding.conf
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 5/12
12/17/2016 UnixCommands
/etc/resolv.conf
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
CrashDump
PerformanceMonitoringandDiagnostics
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
KernelModulesandParameters
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
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 7/12
12/17/2016 UnixCommands
Services
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>
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
useradd
useradd useradd mkuser
create a user # user defaults useradd
systemconfigusers (GUI) sam useradd
/usr/sadm/defadduser
NFS
http://www.datadisk.co.uk/html_docs/misc/unix_commands.htm 9/12
12/17/2016 UnixCommands
uncreate nfs share
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
NTP
LogFiles
Security
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
Misc
# 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
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