Thursday, October 7, 2010

Few commands to know about solaris box

Mostly Solaris is used as production server since it is more robust.

To find total hard disk space
$ iostat -E
sd1       Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: SEAGATE  Product: ST373207LSUN72G  Revision: 045A Serial No: 0543330VQB
Size: 73.40GB <73400057856 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
sd2       Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU  Product: MAW3073NCSUN72G  Revision: 1703 Serial No: 0809B0R45J
Size: 73.40GB <73400057856 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0
sd3       Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
Vendor: TOSHIBA  Product: ODD-DVD SD-C2732 Revision: 1055 Serial No: 
Size: 0.00GB <0 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 1 Predictive Failure Analysis: 0
sd4       Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
Vendor: FUJITSU  Product: MAW3073NCSUN72G  Revision: 1703 Serial No: 0751B0PJ01
Size: 73.40GB <73400057856 bytes>

To find free hard disk space available
$ df -kh
Filesystem             size   used  avail capacity  Mounted on
/dev/md/dsk/d0         7.9G   3.1G   4.7G    40%    /
/devices                 0K     0K     0K     0%    /devices
ctfs                     0K     0K     0K     0%    /system/contract
proc                     0K     0K     0K     0%    /proc
mnttab                   0K     0K     0K     0%    /etc/mnttab
swap                   5.0G   1.3M   5.0G     1%    /etc/svc/volatile
objfs                    0K     0K     0K     0%    /system/object

To find how much disk space used
$ du -sh /
  34G  

To find how much disk space used by a directory
$ du -sh /tmp
 869M   /tmp

To find Total RAM
$ /usr/sbin/prtconf -v | head -2
System Configuration:  Sun Microsystems  sun4u
Memory size: 8192 Megabytes

$ /usr/sbin/prtdiag -v | head -3
System Configuration: Sun Microsystems  sun4u Sun Fire V440
System clock frequency: 177 MHZ
Memory size: 8GB       

To monitor RAM usage by each process
$ top
load averages:  0.03,  0.03,  0.02;                    up 41+21:17:50                                               13:46:14
73 processes: 72 sleeping, 1 on cpu
CPU states: 99.0% idle,  0.4% user,  0.6% kernel,  0.0% iowait,  0.0% swap
Memory: 8192M phys mem, 2906M free mem, 8193M total swap, 8193M free swap

   PID USERNAME LWP PRI NICE  SIZE   RES STATE    TIME    CPU COMMAND
   923 wlsadmin 166  59    0 3290M 1305M sleep   37:47  0.13% java
 28115 wlsadmin 197  59    0 3290M 1344M sleep   63:36  0.12% java
 28164 wlsadmin 142  59    0 3010M  926M sleep   31:51  0.12% java

To know all environment variables that are set
$ env
MANPATH=/usr/share/man:/usr/local/man:/usr/dt/share/man:/usr/openwin/share/man:/usr/local/share/man:/opt/VRTS/man
TERM=vt100
SHELL=/bin/bash
SSH_CLIENT=141.204.63.62 1539 22
SSH_TTY=/dev/pts/2
USER=m64711
MAIL=/usr/mail/m64711
PATH=/usr/bin:/usr/local/bin:/usr/openwin/bin
PWD=/home/m64711
EDITOR=vi
TZ=US/Central
PS1=${LOGNAME}@usppre16:${PWD}$
SHLVL=1
HOME=/home/m64711
LOGNAME=m64711
SSH_CONNECTION=141.204.63.62 1539 135.214.192.188 22
_=/usr/bin/env

To know if the solaris running in 32 or 64 bit mode
The isainfo utility can  answer are  whether  64-bit  applications are supported, or whether
the running kernel uses 32-bit or 64-bit device drivers.
$ isainfo -v
64-bit sparcv9 applications
        vis2 vis
32-bit sparc applications
        vis2 vis v8plus div32 mul32

if you get only 32-bit then it is running in 32 bit mode
if you get both 64-bit and 32-bit then it is running in 64 bit mode

The uname utility prints information about the current  system on the standard output.
$ uname -X
System = SunOS
Node = bsdevprem01
Release = 5.10
KernelID = Generic_127111-08
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 2

To know the installed JVM is capable of running 64-bit version
$ java -d64 -version
java version "1.5.0_15"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_15-b04, mixed mode)

if not 64 bit capable you will get some message like

This Java instance does not support a 64-bit JVM. Please install the desired version.

To know how long the serer is up
$ uptime
  5:15pm  up 78 day(s),  8:39,  3 users,  load average: 6.77, 6.75, 7.46

To know about active processes running
$ ps -ef | grep -i startweblogic
wlsadmin 28145 28140   0   Oct 01 ?           0:00 /bin/sh /sites/WLS/DOMAINS/PREMIERQA1-CASTAGING/bin/startWebLogic.sh
wlsadmin 28096 28091   0   Oct 01 ?           0:00 /bin/sh /sites/WLS/DOMAINS/PREMIERQA1-CAMAIN1/bin/startWebLogic.sh
wlsadmin 28140     1   0   Oct 01 ?           0:00 /bin/sh /sites/WLS/DOMAINS/PREMIERQA1-CASTAGING/startWebLogic.sh

-e list every process running now
-f list full information

For more info man ps

No comments:

Post a Comment