Friday, August 10, 2007

Usual shell command lines translated for windows.

I've discovered that the windows command line is far from being poor.
For some aspects I would even say that cmd.exe may be not less powerful than sh.
Here is a list of usual command I use translated to windows command tool.
Hope this help someone people crying for awk while doing scripting on windows ,  should have a closer look to "FOR /?" :-)
 

 /bin/ls -l 
dir /N /Q
 grep -i ^bla myfile.txt
 findstr /B /I "bla" myfile.txt
 grep -v -i ^bla myfile.txt
 findstr /V /B /I "bla" myfile.txt
 find /tmp -name *.c | xargs | grep blo
 findstr /S blo C:\\tmp *.c
 find /tmp -name *.c
 dir /S /B C:\\tmp\\*.c
 echo $?
 echo %ERRORLEVEL%
 ls *.c 2>/dev/null  
 dir *.c 2>NUL
 pwd
 echo %CD%
 echo $0
 echo %CMDCMDLINE%
 exit 12
 exit /B 12 
 dirname $1
 %~p1
 basename $1
 %~nx1
 which $1
 %~dp$PATH:1
 env | grep TERM
 set TERM 2>NUL
su - foo -c command       
runas /profile /user:foo command       
rsh myHost -l foo command       
rexec myHost -l foo command       
for file in `find /tmp -name *.txt` do   echo `basename $file` done
 for /R C:\\TEMP %i in (*.txt) DO echo %~ni

Thursday, August 2, 2007

Unix Performance info commands.

The basic list of KEY tools historically available for monitoring
performance applies to nearly any Unix/Linux distribution, including the
following partial list of common utilities used ... following the basic
breakdown of computing subsystems :

** CPU / Kernel Utilization :

--> vmstat (vm system cpu and kernel utilization metrics ** a great
starting pt **)
--> mpstat (multi processor .. per cpu performance statistics)

** Memory / Kenel Utilization :

--> vmstat
--> swap
--> top

** I/O Performance

--> iostat (Standard IO.. ufs, .. IO performance utility)
--> vxstat (Veritas vxfs filesystem IO performance)

** Network Utilization

--> netstat
--> ping
--> traceroute

** Process / Kernel

--> ps
--> top
--> prstat

--> sar (provides most basic types of high level performance metrics,
assuming that __________system accounting is turned on)

** SETTING SOLARIS 10 Above and Beyond other Unix / Linux Distributions
... ** :

In addition to the basic toolsets available, there exist the following
key additions that Solaris 10 provides, which sets it apart from the
other Unix / Linux variants.

** DTrace (Dynamic Tracing via "D" language scripting and probe/providers)

__ Dtrace is the Electron microscope of performance analysis for a
Solaris 10 system

** Mdb (Modular Debugger)

___________________________________________________________________________________

SYS_DIAG :

Over the past several years, I have created a utility called "sys_diag"
that offers the capability of automatically capturing performance
statistics, using nearly all available system utilities.. and
aggregating the data, performing analysis and HTML report generation of
findings. Sys_diag creates a single .tar.Z compressed archive that can
be emailed/ftp'd.. for performing system configuration and/or
performance analysis off-site.. from virtually anywhere.. saving a LOT
of time.. not requiring any 3rd party tools or agents to be installed on
a system other than downloading the "sys_diag" ksh script itself (with a
color coded dashboard.. and links to detailed analysis findings).

Sys_diag can be used to also generate a detailed configuration snapshot
report, including OS, HW, Storage, SW, 3PP configuration attributes,
among several other capabilities that it provides.

** See the next blog entry for more details and examples on sys_diag **.
The published repository and high level description of sys_diag is
always available at BigAdmin using the following URL :
http://www.sun.com/bigadmin/jsp/descFile.jsp?url=descAll/sys_diag__solaris_c


sys_diad ksh script:

http://www.sun.com/bigadmin/scripts/submittedScripts/sys_diag.txt