Wednesday, May 9, 2012

Aide Memoire - Commands for Linux, WebSphere Application Server and IBM HTTP Server

I could print this stuff out, but then I'd have to carry paper - perhaps I should create an ePub with this stuff in ......

All of these came from this rather excellent blog: -


or, more specifically, this post.

Find the process that uses most CPU

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -2

Find the last 10 process that use the most CPU

ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10

Find cpu usage

mpstat -P ALL

Display the size of the current directory, plus all subdirectories

du -ch | grep total

Domain Information Groper (DIG) - look at DNS etc.

dig <hostname or IP address>

Get details of a network adapter

 /usr/sbin/ethtool eth0

Find occurrences of strings in files AND report file names

find . -name '*.xml' -print | xargs grep 'hostName' /dev/null

Find files over a certain size e.g. 10K

find / -xdev -size +1024 -exec ls -al {} \; | sort -r -k 5

Find and tar files on the fly

find /opt/IBM/WebSphere/PortalServer/log -name 'System*.log'| xargs tar -rvf System_logs.tar

Output wsadmin to console AND file

/opt/IBM/WebSphere/wp_profile/bin/wsadmin.sh -lang jython | tee wsadmin.log

Find files touched in, say, the past 20 minutes

find * -mmin -20

Run a command on a loop

watch -d=10 -n 1 "netstat -a"

Show expiry of WAS SSL key and trust stores ( assuming that password is still WebAS )

find /opt/IBM/WebSphere/wp_profile -name *.jks | xargs -i bash -c '/opt/IBM/WebSphere/AppServer/java/bin/java -classpath /opt/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmjceprovider.jar:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmjcefw.jar:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext/US_export_policy.jar:/opt/IBM/WebSphere/AppServer//java/jre/lib/ext/local_policy.jar:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext/ibmpkcs.jar:/opt/IBM/WebSphere/AppServer/java/jre/lib/ext com.ibm.gsk.ikeyman.ikeycmd -cert -list all -expiry -db {} -type jks -pw WebAS'

Show expiry of IHS SSL key and trust stores ( assuming that password is still WebAS )

find /opt/IBM/HTTPServer -name *.kdb | xargs -i bash -c '/opt/IBM/HTTPServer/Plugins/java/jre/bin/java -classpath /opt/IBM/HTTPServer/Plugins/java/jre/lib/ext/ibmjceprovider.jar:/opt/IBM/HTTPServer/java/jre/lib/ext/ibmjcefw.jar:/opt/IBM/HTTPServer/Plugins/java/jre/lib/ext/US_export_policy.jar:/opt/IBM/HTTPServer/Plugins//java/jre/lib/ext/local_policy.jar:/opt/IBM/HTTPServer/Plugins/java/jre/lib/ext/ibmpkcs.jar:/opt/IBM/HTTPServer/Plugins/java/jre/lib/ext com.ibm.gsk.ikeyman.ikeycmd -cert -list all -expiry -db {} -type cms -pw WebAS '


No comments:

Post a Comment