Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
138 views14 pages

Unix Commands for HP, RedHat & Solaris

Common Unix commands are provided for system information, networking, storage, and software management on HP, Red Hat, and Solaris systems. Commands include sysinfo, ifconfig, route, ps, top, df, du, lsmod, modprobe, services, and rpm/pkgadd. NFS commands like showmount, exportfs, and mount are covered. Kernel parameters can be viewed and modified with sysctl.

Uploaded by

Ricky Jamero
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views14 pages

Unix Commands for HP, RedHat & Solaris

Common Unix commands are provided for system information, networking, storage, and software management on HP, Red Hat, and Solaris systems. Commands include sysinfo, ifconfig, route, ps, top, df, du, lsmod, modprobe, services, and rpm/pkgadd. NFS commands like showmount, exportfs, and mount are covered. Kernel parameters can be viewed and modified with sysctl.

Uploaded by

Ricky Jamero
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Common Unix Commands for HP, RedHat & Solaris

Swap Sysinfo Services NFS Disk Kernel Modules Networking Patching / Packages Accounts NTP Log Files Security Misc swap Solaris swap -l swap -s

Information regarding the swap area Display system information i.e cpu, memory, etc Display, start and stop services Information on NFS i.e starting, stopping, etc Displaying disk information i.e type, serial number, etc Displaying and modifing kernel parameters Display and configuring network parameters Installing and removing patches and software packages Setting up and removing user accounts Network Time Protocol Location to common log files Security information Other stuff i.e shutdown, timezone, run level, etc

display swap

Red Hat cat /proc/swaps (detailed) swapon -s device: create partition with fdisk (type 82) file: dd if=/dev/zero of=/var/swapfile bs=1024 count=65536 mkswap <device>|<file> swapon <device>|<file> update /etc/fstab swapoff <device>|<file>

mkfile 5m /var/swapfile swap -a /var/swapfile update /etc/vfstab adding swap

HP swapinfo (displayed in KB) swapinfo -m (display in Mb) swapinfo -tm (total / Mb) Create logical volume or filesystem swapon <device> | -f <logical device> swapon -p 3 <device> | -f <logical device> update /etc/fstab Note: -p = priority swap number remove entry from /etc/fstab

removing swap update /etc/vfstab

Common Unix Commands for HP, RedHat & Solaris

swap -d Remove device or file as normal sysinfo Solaris /usr/platform/`uname -r` /sbin/prtdiag -v prtdiag -v prtpicl -v [-c <class>] prtconf -D /usr/platform/`uname -r` /sbin/prtdiag -v prtconf | grep -i mem /usr/platform/`uname -r` /sbin/prtdiag -v format prtvtoc <device> format -e (to convert EFI (zfs) to SMI) format iostat -En luxadm inq <disk> (A5x00 disk arrays) prtvtoc <device> Red Hat

reboot

Server type Hardware Info

HP model uname -a

lspci lsusb cat /proc/meminfo (detailed) free -om cat /proc/cpuinfo (detailed) fdisk -l sfdisk -l (advanced server) parted <device> print partprobe <device> hdparm -i /dev/hda hdparm -I /dev/hda (detailed) cat /proc/ide/ide0/hda/model fdisk -l sfdisk -l (advanced server) cat /proc/partitions (very high level) dmesg | grep -i physical /usr/sam/lbin/getmem /opt/ignite/bin/print_manifest /opt/ignite/bin/print_manifest sam -> performance monitors -> system properties ioscan -funC disk

Memory CPU (type, number, etc)

Disk Drives

Disk serial Number, type, etc

diskinfo -v /dev/rdsk/c0t4d0 (detailed but no serial number) /opt/ignite/bin/print_manifest (no serial number) lifls -Clv <device>

Disk disk partitions

Common Unix Commands for HP, RedHat & Solaris

List Raw Partitions Tune Filesystems

n/a tunefs fstyp -v <device> isainfo -kv (solaris 9+) isalist (sparc v9 will be listed first)

Kernel 32 or 64

raw -qa tune2fs tune2fs -l /dev/sda1 uname -a uname -m getconf -a |grep -i 'long_bit'

n/a tunefs getconf KERNEL_BITS ( version 11) HPUX < version 11 all 32 bit

At the OK prompt type banner Display Firmware

Note: determine if system supports 64 bit getconf HW_CPU_SUPP_BITS boot into the BIOS (normally F2 or workstations: F12) reboot enter PDC type: IN (information menu) type: FV (Firmware Version) servers: download and install tusc tusc -p <pid> n/a

truss -p <pid> Trace system calls Display IRQ, IO ports and DMA Services Solaris 10 svcs -a inetadm -l svcadm enable nfs svcadm disable nfs svcadm refresh nfs n/a

strace -p <pid>

/proc/interrupts /proc/ioports /proc/dma

display services start services stop services reload service

Red Hat services --status-all service nfs start service nfs stop service nfs reload

HP n/a n/a n/a n/a

Common Unix Commands for HP, RedHat & Solaris

restart service service status service dependencies service dependants service logging, etc

svcadm restart nfs svcs nfs svcs -d network svcs -D network /var/svc/log /var/svc/manifest /lib/svc/method

service nfs restart service nfs staus n/a n/a n/a

n/a n/a n/a n/a n/a

NFS Solaris server: mountd, nfsd client: statd, lockd NFS Daemons /etc/dfs/dfstab /etc/dfs/sharetab dfshares showmount -e localhost /etc/dfs/dfstab (edit and add share) share <path> /etc/exports showmount -e localhost redhat-config-nfs (GUI) showmount -e localhost cat /etc/xtab (currently exported) /etc/rc.config.d/nfsconf (edit) /etc/exports (edit and add share) exportfs -a Red Hat server: rpc.mountd,nfsd client: rpc.statd, lockd HP server: rpc.mountd, nfsd client: rpc.statd, lockd

display nfs shares

create nfs share

uncreate nfs share

nfs start

/etc/exports (edit and add share) /sbin/service nfs reload unshare <path> /etc/exports (edit and remove share) /etc/rc.config.d/nfsconf (edit) /etc/dfs/dfstab (edit and remove share) /sbin/service nfs reload exportfs -au (unshare all) exportfs -u /home/vallep /etc/exports (edit and remove share) /etc/init.d/nfs.server start /sbin/service nfs start /sbin/init.d/nfs.core start /etc/init.d/nfs.client start /sbin/init.d/nfs.server start /sbin/init.d/nfs.client start svcadm enable nfs/server svcadm disable nfs/server

Common Unix Commands for HP, RedHat & Solaris

nfs stop nfs status nfs reload nfs performanace List nfs clients that have remote mount Disk Solaris eeprom Display the boot device

/etc/init.d/nfs.server stop /etc/init.d/nfs.client stop ps -ef|grep < nfs daemons> shareall nfsstat cat /etc/rmtab

/sbin/service nfs stop

/sbin/service nfs status /sbin/service nfs reload nfsstat

/sbin/init.d/nfs.client stop /sbin/init.d/nfs.server stop /sbin/init.d/nfs.core stop ps -ef | grep <nfs daemons> exportfs -a nfsstat cat /etc/rmtab

Red Hat cat /etc/grub.conf cat /etc/lilo.conf

HP setboot

setting the boot device Creating boot device (MBR)

setenv boot-device <device> | <alias> eeprom boot-device <device> | <alias>

grub = grand unified boot loader lilo = linux loader /etc/grub.conf setboot -p <primary path> /etc/lilo.conf setboot -a <alternate path>

grub-install <raw-device> lilo -v floppy --probe (use device obtained below ) format floppy drive floppy --createrc > /etc/fd0 floppy --format /dev/fd0 mkfs /dev/fd0 volrmmount -l floppy0 mount /dev/fd0 /mnt/floppy mount/unmount floppy eject floppy umount /mnt/floppy mount/unmount CDROM mount -F hsfs -o ro <device path> /cdrom/cdrom0 mount -rt iso9660 /dev/cdrom umount /cdrom/cdrom0 /mnt/cdrom

installboot /usr/platform/`uname -i` /lib/fs/ufs/bootblk <raw-device> fdformat -v -U volcheck -v newfs -v /vol/disk/aliases/floppy0

mkboot n/a

n/a mount -rF cdfs /dev/dsk/c1t6d0 /cdrom

Common Unix Commands for HP, RedHat & Solaris

/etc/init.d/volmgr start eject cdrom n/a create boot disk or recovery tape ok> boot cdrom -s boot cdrom/diskette (single user) ok> boot -as boot into maintenace mode

umount /mnt/cdrom eject cdrom

start: /usr/sbin/pps_mountd pps_mount mkbootdisk `uname -r` (boot recovery tape (preview) diskette) make_tape_recovery -v -l -x inc_entire=vg00 /opt/ignite/bin/make_recovery -ACv linux single (at the boot prompt) enter PDC > search >boot p1 (cdrom) interact with IPL? Y ISL> hpux -is f10 or f12 >boot pri interact with IPL? Y ISL> hpux -lm

Kernel Modules Solaris modinfo display loaded modules Location: /lib/modules/`uname -r`/kernel/drivers modprobe <module> insmod modprobe -r <module> rmmod /etc/sysctl.conf (edit and update then reboot) sysctl -p <filename> Red Hat cat /proc/modules (more detailed) lsmod HP kmadmin -k

load modules unload modules set kernel parameters

modload -p drv/st modunload -i drv/st edit /etc/system reboot

kmadmin -L <module name> kmadmin -U <module name> kmadmin -u <module id> kcweb (11i) kctune (11i only) rebuild kernel (< 11i see below)

Common Unix Commands for HP, RedHat & Solaris

sysctl -w param=value No reboot (dynamically): echo "250 32000 100 28" > /proc/sys/kernel/sem echo "536870912" > /proc/sys/kernel/shmmax echo "4096" > /proc/sys/kernel/shmmni echo "2097152" > /proc/sys/kernel/shmall etc............................................. sysctl -a cat /etc/sysctl.conf cat /proc/sys/kernel/sem cat /proc/sys/kernel/shmmax etc................................... ipcs -a cd /usr/src/linux-2.4 edit Makefile (change EXTRAVERSION) make mrproper backup .config make xconfig make dep make bzImage make modules move new kernel make modules_install change lilo/grub config file reboot

cat /etc/system sysdef -i ipcs -a display kernel parameters

kctune (11i only) sysdef kmtune kmsystem /usr/sam/lbin/getkinfo -f /stand/vmunix -o /tmp/kernel.data

edit and update file then reboot: /etc/system

build kernel

cd /stand/build /usr/lbin/sysadm/system_prep -s system edit system file /usr/sbin/mk_kernel -s ./system mv /stand/system /stand/system.old mv /stand/vmunix /stand/vmunix.old mv /stand/build/system /stand mv /stand/build/vmunix_test /stand/vmunix reboot

Networking

Common Unix Commands for HP, RedHat & Solaris

Basic network information (hostname, ip address) default router

Solaris /etc/hostname.hme0 /etc/defaultrouter

Red Hat /etc/sysconfig/network edit /etc/sysconfig/network add: GATEWAY=<IP address> /sbin/ifup eth0 /sbin/ifdown eth0 mii-tool -v ethtool eth1 ethtool -t eth0 online

HP /etc/rc.config.d/netconf /etc/rc.config.d/netconf

Starting and stopping a network ifconfig qfe0 up interface ifconfig qfe0 down ndd -get <device> <parm> ndd -get dev/ip \? (list all params) NIC speeds or Parameters kstat hme:0 ndd -set <device> <parm> <value> (dynamically) /etc/system (edit and update then reboot - permanent) if_mpadm -d (detach) if_mpadm -r (reattach) tail /var/adm/messages netstat -n prtdiag -v ifconfig -a ifconfig -a (as user root) /etc/resolv.conf /etc/nsswitch.conf /etc/resolv.conf

ifconfig lan0 up ifconfig lan0 down lanadmin -x ndd -get <device> <parm> ndd -get /dev/ip \? (list all params)

Setting NIC speed

sysctl -a | grep net* mii-tool -F 100baseTx-FD eth0 ndd -set <device> <parm> <value> ethtool -s eth1 speed 100 duplex full lanadmin -X <option> lan0

Test IPMP, Bonding display routing table displaying network interfaces display MAC address setup DNS Name service switch file (DNS client)

ifenslave -d bond0 eth1 (detach) ifenslave bond0 eth1 (reattach) cat /proc/net/bonding/bond0 netstat -rn ifconfig system-config-network (GUI) ifconfig system-config-network (GUI) /etc/resolv.conf /etc/nsswitch.conf /etc/host.conf /etc/resolv.conf

netstat -rn ioscan -funC lan (list hardware) lanscan -v (list configured) ifconfig lan0 (individual) lanscan /etc/resolv.conf /etc/nsswitch.conf /etc/resolv.conf

Common Unix Commands for HP, RedHat & Solaris

snoop -d <interface> Displaying network packets

tcpdump -i <interface> ethereal (needs to be installed)

nettl -start nettl -status all nettl -tn pduin pduout -e ns_ls_driver -file /var/adm/LAN nettl -stop use netfmt to display the trace file

Domain Name Obtain IP Address routing Patching / Software

/etc/defaultdomain route -n get <hostname>

/etc/sysconfig/network (GATEWAY option) ip route get <IP address>

Solaris Red Hat showrev -p display installed patches patchadd -p patchadd patch -p1 <patch> patchadd -M <dir> (multiple patches) zcat patch46.gz | patch -p1 adding patch Note: -p = # of path stripping removing patch display installed packages patchrm pkginfo (all packages) pkginfo -l (single package) pkgchk -l -p <file> (file belongs) pkgadd adding package removing packages verify package pkgrm pkginfo -l patch -R -p1 <patch> rpm -qa (all packages) rpm -q (single package) rpm -qf (file belongs) rpm -qi <package> (very detailed) rpm -Uhv (updates/installs if not already) rpm -ihv (install) rpm -e rpm -V package

HP swlist -l patch (HP 11) swlist -l product PH* (HP 10.x) swcopy (install patch into depot) swinstall (install patch from depot) Note: the swagentd daemon must be running swremove swlist -l bundle <bundle> swlist -l product <product>

swinstall

swremove swverity <fileset> (see

Common Unix Commands for HP, RedHat & Solaris

List files in package Accounts

pkginfo -p pkgchk -l <package> | grep -i pathname

rpm -ql <package>

/var/adm/sw/swagent.log) swlist -l file <product>

display users adding a user removing a user modifying a user password files NTP

Solaris cat /etc/passwd logins useradd userdel usermod /etc/passwd /etc/shadow

Red Hat cat /etc/passwd system-config-users (GUI) useradd system-config-users (GUI) userdel system-config-users (GUI) usermod system-config-users (GUI) /etc/passwd

HP cat /etc/passwd logins useradd sam userdel sam usermod sam /etc/passwd /tcb/files/auth/r/root (trusted system)

Time daemons

ntp setup

Solaris xntpd Edit: # Solaris 8 /etc/ntp.conf /etc/ntp.server /etc/ntp.client # Solaris 10 /etc/inet/ntp.server /etc/inet/ntp.client

Red Hat ntpd chkconfig --list ntpd chkconfig --level 2345 ntpd on /etc/ntp.conf (edit with ntp servers) /sbin/service ntpd start dateconfig (GUI)

HP netdaemons /etc/rc.config.d/netdaemons (set XNTPD to 1) /etc/ntp.conf

Common Unix Commands for HP, RedHat & Solaris

NTP Trace commands Log Files

ntpq -p ntptrace

ntpq -p ntptrace

messages syslog mail cron boot Security

Solaris /var/adm/messages /var/log/syslog /var/cron/log /var/adm/messages

Red Hat /var/log/messages n/a /var/log/mail /var/log/cron /var/log/boot

HP n/a /var/adm/syslog/syslog.log /var/adm/syslog/mail.log /var/adm/cron/log /var/adm/syslog/syslog.log

Solaris Checking the passwd file pwck checking the group file grpck /etc/default/login (Edit file no reboot console login (allow/deny) required) Misc Solaris eeprom startup shutdown setenv boot-device shutdown -i5 -g0 -y (power down) shutdown -i6 -g0 -y (reboot) shutdown -i0 -g0 -y (OK prompt)

Red Hat pwck grpck /etc/securetty (no reboot)

HP pwck grpck /etc/securetty (no reboot)

Red Hat grub (GUI) lilo (text based) shutdown -h (halt) shutdown -r (reboot) shutdown -f (fast reboot no fsck) shutdown -F (force fsck)

HP setboot -p

shutdown -h -y (halt) shutdown -r -y (reboot)

Common Unix Commands for HP, RedHat & Solaris

init status 0 1 2 3 4 5 6

reboot -- -r (reboot/reconfigure) shutdown single user n/a Multi-user n/a power off reboot -s single user -a interactive -x no device drivers (used in clustering) -r reconfigure devices -m milestone

halt single user multiuser (no networking) multiuser (networking) unused GUI reboot linux single linux emergency linux rescue single: runlevel1, local fs mounted, no network emergency: root fs read-only, no init files run rescue: use cd-rom/network, root mounted as /mnt/sysimage /etc/init.d /etc/rc0.d - /etc/rc6.d runlevel cat /etc/inittab startx (shorthand of below) initx (lots of parms) touch /forcefsck shutdown -rF now /usr/bin/getconf -a| egrep -i 'pagesize|page_size' netconf /etc/sysconfig/clock

halt single users multiuser (no networking) multiuser (networking and GUI) multiuser (netwrking and old GUI) n/a n/a

Startup options

/etc/init.d startup scripts /etc/rc0.d - /etc/rc6.d determine the run level who -r obtain default run level cat /etc/inittab n/a start xwindows force a fsck page size (memory) initialize system Timezone n/a /usr/bin/pagesize sys-unconfig /etc/TIMEZONE /etc/default/init

/etc/rc.config.d /sbin/rc0.d - /sbin/rc6.d who -r /etc/inittab n/a n/a 4Kb set_parms initi /etc/TIMEZONE

Common Unix Commands for HP, RedHat & Solaris

update /dev directory

drvconfig devlinks disks|tapes|ports devfsadm ( solaris 8, 9, 10) rem_drv prtconf -D change the follwing four files:

/dev/MAKEDEV <device>

insf -C tape (Class) insf -H 0.1.0 -e (recreate deleted link) rmsf lsdev

remove device list device drivers

cat /proc/devices

change the hostname

/etc/nodename /etc/hostname.<interface> /etc/inet/hosts /etc/inet/ipnodes floppy: disk: /dev/dsk/c0t0d0s0 floppy: /dev/fd0 disk: /dev/hda or /dev/sda /dev/hdb or /dev/sdb tape: cdrom: /dev/dsk/c0t6d0s0 dumpadm -d <device> cdrom: /dev/hda (depends on number of IDE disks) diskdump netdump kdump (part of kexec rpm) crash (used to analyse crash dumps) floppy: n/a disk: /dev/dsk/c0t6d0 tape: /dev/dsk/rmt/0 cdrom: /dev/dsk/c1t6d0 edit /stand/system add either: dump 2/0/1.5.0 dump lvol dump none

Device paths

tape: /dev/rmt/0ucb

Crash Dump

crash (used to analyse crash dumps) adb (used to analyse crash dumps)

Common Unix Commands for HP, RedHat & Solaris

Boot (jumpstart) servers: rpcinfo -b bootparam 1 Find Services on network NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1

Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1

Boot (jumpstart) servers: rpcinfo -b bootparam 1 NFS servers: rpcinfo -b mountd 1 NIS servers/slaves: rpcinfo -b ypserv 1

You might also like