Useful Unix Commands

ACCESSING THE OPEN BOOT PROMPT - 'Stop-A'

  • From the console, issue the following key sequence:
   <Esc> <Ctrl> B

CHECK WHICH BIT-MODE IS RUNNING

   isalist -v

   isainfo -v

CRONTAB SCHEDULE SETTINGS

   minute              (0-59)
   hour                (0-23)
   day of the month    (1-31)
   month of the year   (1-12)
   day of the week     (0-6 with 0=Sunday)

DISPLAY DISK GEOMETRY & PARTITION INFO

   prtvtoc /dev/rdsk/c0t0d0s0

DISPLAY CURRENT RUN LEVEL

   who -r

DISPLAY DEVICE LIST & ASSOCIATED DRIVERS

   prtconf -D

DISPLAY HARD DRIVE INFO - (Vendor, RPM, Capacity)

   iostat -E

DISPLAY HIGHEST CPU UTILIZATION

   ps -eo pid,pcpu,args | sort +1n

DISPLAY HIGHEST MEMORY UTILIZATION

   ps -eo pid,vsz,args | sort +1n

DISPLAY I-NODE INFO

   df -F ufs -o i

DISPLAY SYSTEM CONFIGURATION

   /usr/platform/`uname -i`/sbin/prtdiag

DISPLAY VERSION OF BIND

   nslookup -class=chaos -q=txt version.bind ns0.optix.org

DISPLAY VERSION OF CDE

   /usr/ccs/bin/what /usr/dt/bin/dtmail

ESCAPING FROM A REMOTE LOGON

  • Starting with a connection on Host A use rlogin or ssh to connect to Host B.
  • In order to escape back to Host A, type ~^Z - (tilde followed by Ctrl-Z).
  • To return back to the remote shell on Host B, type fg.

FIND A STRING

  • To find all files from the current directory downwards and search for a string in each file found:
   find . -exec grep -i <string> {} \;

FIND WHICH PACKAGE A FILE BELONGS TO

   pkgchk -l -p <full pathname to file>

LIST DYNAMIC DEPENDENCIES - 'ldd'

The ldd utility lists the dynamic dependencies of executable files or shared objects. ldd uses the runtime linker, ld.so.1, to generate the diagnostics. The runtime linker takes the object being inspected and prepares the object as would occur in a running process. By default, ldd triggers the loading of any lazy dependencies.

ldd lists the path names of all shared objects that would be loaded when filename is loaded. ldd expects the shared objects that are being inspected to have execute permission. If a shared object does not have execute permission, ldd issues a warning before attempting to process the file.

  • Usage:
   ldd  <filename>

LIST FILE NAMES INCLUDING DIRECTORY PATH

   find /u0[2-5,7-9] ! -type d ! -type l -print

PRINT VERSION OF OPEN BOOT PROM (OBP)

   prtconf -V

   /usr/platform/`uname -i`/sbin/prtdiag -v | grep OBP

PRINT VERSION OF OPEN WINDOWS

   showrev -w

SHOW APPLIED PATCHES

   showrev -p

SHOW AVAILBALE MONITOR RESOLUTIONS

   /usr/sbin/ffbconfig -res \?

SHOW NFS EXPORTED FILE SYSTEMS

   showmount -e NFS_SERVER

SHOW PROCESSOR TYPE & SPEED

   psrinfo -v

   cat /proc/cpuinfo

SHOW ROUTE TO A SPECIFIED NETWORK

   route -n get xxx.yyy.zzz.0

SHOW SYSTEM CONFIGURATION

  sysdef

TAR & COMPRESS IN ONE COMMAND

   tar -cvf <tar file name> | compress -

USING ufsrestore

  • To perform a ufsrestore perform the following steps:
    • cd <target directory>
    • Confirm enough disk space is available, e.g. df -k .
    • ufsrestore -if /dev/rmt/0 - i=interactive; f=file
    • At ufs> prompt, ls - lists the dump file
    • At ufs> prompt, cd <directory containing dump file>
    • At ufs> prompt, add <file to be restored>
    • At ufs> prompt, extract
    • At ufs> prompt, Next Volume? - always reply 1
    • At ufs> prompt, Owner? - always reply Y

VIEW A FILE WITH '+' IN THE NAME

   view   --  <file name>

xargs COMMAND

  • Builds and executes command lines from standard input.
    • Example: To concatenate the contents of all the files whose names are contained in filelist into filecontents.
         xargs cat <filelist  >filecontents
© copyright 2001-2014 ABCdba.com | all rights reserved