1.首先查出某个进程的pid,然后使用ps命令
[root@hadoop1 ~]# jps 2640 Jps 2339 DataNode 2239 NameNode [root@hadoop1 ~]# ps -p 2239 -o etime ELAPSED 02:47
2.先输出所有进程的信息,然后查找某个进程
[root@hadoop1 ~]# ps -eo etime,cmd | grep NameNode 10:23 /root/softs/jdk1.8.0_172/bin/java -Dproc_namenode -Xmx1000m -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/root/softs/hadoop-2.7.3/logs -Dhadoop.log.file=hadoop.log -Dhadoop.home.dir=/root/softs/hadoop-2.7.3 -Dhadoop.id.str=root -Dhadoop.root.logger=INFO,console -Djava.library.path=/root/softs/hadoop-2.7.3/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Dhadoop.log.dir=/root/softs/hadoop-2.7.3/logs -Dhadoop.log.file=hadoop-root-namenode-hadoop1.log -Dhadoop.home.dir=/root/softs/hadoop-2.7.3 -Dhadoop.id.str=root -Dhadoop.root.logger=INFO,RFA -Djava.library.path=/root/softs/hadoop-2.7.3/lib/native -Dhadoop.policy.file=hadoop-policy.xml -Djava.net.preferIPv4Stack=true -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS -Dhdfs.audit.logger=INFO,NullAppender -Dhadoop.security.logger=INFO,RFAS org.apache.hadoop.hdfs.server.namenode.NameNode