通常情况我们可以通过ps来检查unix的某个进程。
比如:ps -ef|grep java
noaccess 991 1 0 03:35:23 ? 0:13 /usr/java/bin/java -server -Xmx128m -XX:+UseParallelGC -XX:ParallelGCThreads=4
root 3227 1764 0 03:47:42 pts/4 1:09 ../../products/javaruntime__99130__sax__xx__sp0__1/bin/java -Xmx1024M -jar depl
root 3788 3787 0 04:00:58 pts/4 0:35 /usr/jdk/jdk1.6.0_33/jre/bin/java -Xmx512M -classpath /tmp/_setup1764/products/
root 3935 3924 0 04:02:05 pts/4 0:05 /usr/jdk/instances/jdk1.6.0/jre/bin/amd64/java -classpath /usr/jdk/instances/jd
root 3924 3903 0 04:01:52 pts/4 0:24 /usr/jdk/instances/jdk1.6.0/bin/amd64/java -Dprod.props.file=/usr/local/Oracle/
root 3960 3936 0 04:02:16 pts/4 0:20 /usr/jdk/instances/jdk1.6.0/bin/amd64/java -client -Xms256m -Xmx512m -XX:Compil
root 4849 4847 0 04:25:29 pts/6 0:00 grep java
但问题是后面的进程信息都是有限的节选。
怎么看详细的信息呢?
/usr/ucb/ps auxww [PID]
比如我想看 3924
bash-3.00# /usr/ucb/ps auxww 3924
USER PID %CPU %MEM SZ RSS TT S START TIME COMMAND
root 3924 0.1 3.4367604271876 pts/4 S 04:01:51 0:24 /usr/jdk/instances/jdk1.6.0/bin/amd64/java -Dprod.props.file=/usr/local/Oracle/Middleware/wlserver_12.1/.product.properties -Xms32m -Xmx200m -XX:PermSize=128m -XX:MaxPermSize=256m weblogic.WLST /usr/local/SASHome/SASDeploymentManager/9.3/products/cfgwizard__93455__prt__xx__sp0__1/weblogic/Config/sas.py create domain SASDomain credentials=/tmp/_setup1764/credentials1350429317.properties scriptMode=sdw
就可以看到该java进程详细的参数信息,很具体。
对于怎么查看端口对应的进程,一般都是用iosf
但是Solaris9以后没有相应的版本了。
我调试过的一个脚本,可以很方面的查得相应的进程,足够使用,无版本限制啊。
下载地址如下:
grep_port_pid.sh
另附其他常用的unix命令,供参考:
Run job in batch now: at -s now < thejob.sh Show current process active ps -efa Show process information psrinfo -v Show version of unix uname -a Display System Configuration sysdef or prtconf Print VTOC prtvtoc /dev/dsk/c0t0d0s0 Query Disk space df -k disk space in kilobytes du -sk disk space summary in kilobytes How To Configure Sun 450 Hot swap disk drives 1. drvconfig 2. disks Remove all files and sub-directories rm -r * Move all files from one directory to another using tar pipe from directory /var mkdir /var1 cd /var tar cf - . | (cd /var1 && tar xBf -) Directory compare (don't show files that are the same) dircmp -s /var /var1 Give User execute permission on a file chomod u+x filename gives execute permission to the owner. Find command to find in current directory and sub directory find . -name "dbmslogmnr.sql" -print DATE Command date mmddHHMM[[cc]yy] example "date 022610221998" Get DATE from another unix box rdate pluto Find Command for certain size files find . -size +10000c This example say find all the file > 10000 bytes. Find command to find a word in the directory and sub directory find . -exec grep -ls pkzip {} ;