Find the Command Line Of
a Process
Dev:vx1379:djbs002-7996 $ /usr/bin/strings
/proc/7728/cmdline
/software/java32/jdk1.6.0_16/bin/java
-Djbs.name=JAS-A2
-server
-Xms512m
-Xmx512m
-XX:MaxPermSize=256m
-Dcom.sun.management.jmxremote.port=10009
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.security.auth.login.config=/config/jboss/ews/1.0/domains/jas/JAS-A2/conf/login.config
-Djbs.logdir=/logs/jboss/ews/1.0/domains/jas
-javaagent:/software/jboss/ews32/1.0/lib/spring-agent.jar
.
.
start
Scheduler class for a process in linux
ps ax --format
uname,pid,ppid,tty,cmd,cls,pri,rtprio
Details about Process
ps -fp $(pgrep -d, -x java)
ps -ef : This output shows that the first process that is executed when the
system boots
Highest CPU
ps -eo pcpu,pid,user,args |
sort -k 1 -r | head -10 | awk "{ print $2
}"
Tar file correctly Copied or Not
tar -ztf
/path/to/archive.tar.gz > /dev/null && echo $? If echo $? = 0
memory Usage
sar -q 1 | tail -1 | awk '{
print "" $3}' | sed 's/%//g'
Finding the CPU Threashold
top -b -n 1 | awk -F'[:,]'
'/^Cpu/{sub("\\..*","",$2); print $2}'
Current User With Session Count
who |
awk '
{ User [$1]++; }
END { for (i in User) printf "%-9s %s\n", i, User [i] }
Top 10 Process
ps -efF "%x %p %P %U %u
%y %a" | sort -r | head
Memory Space Details
free -t -m | grep
"Total" | awk '{ print "Total Memory space : "$2 "
MB";
print "Used Memory Space
: "$3" MB";
print "Free Memory :
"$4" MB";
}'
Swap memory Details
free -t -m | grep "Swap"
| awk '{ print "Total Swap space : "$2 " MB";
print "Used Swap Space :
"$3" MB";
print "Free Swap :
"$4" MB";
}'
Remove Files Using Find
Dev:vx1111:bs002-jas $ find
. -type f -atime +60 -print > ./deadFiles
Dev:vx1111:bs002-jas $ cat
./deadFiles
./JAS-B2/conf/logs/juli.2010-02-11.log
./JAS-B2/bin/logs/juli.2010-01-06.log
./JAS-B2/bin/logs/juli.2009-11-05.log
./JAS-B2/bin/logs/juli.2010-02-11.log
./JAS-C2/catalina.out
./JAS-C2/conf/catalina.out
Dev:vx1111:bs002-jas $ rm
`cat ./deadFiles`
How to Find Files That Exceed a Specified Size Limit
find . -size +400 -print
How to List the Newest Files
ls -t
most recently Created or Changed
ls -tl
List Process By memory usage
ps -e -orss=,args= | sort -b
-k1,1n | pr -TW$COLUMNS