linux查看服务进程,Linux_18下查看进程的启动和运行时间

有时需要知道某进程运行的时间或是否已经运行完成,比如我想知道我sra文件转换成fq格式的转化速度。以便我做好时间安排。

1 ps - o命令

$ ps -eo pid,tty,user,comm,lstart,etime|grep fastq

参数说明:

pid:进程ID

tty:终端

user:用户

comm:进程名

lstart:开始时间

etime:运行时间

运行结果如下:

91413 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91414 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91415 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91416 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91417 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91418 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91419 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91420 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91421 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91422 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91423 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91424 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91425 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91426 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91427 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91428 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91429 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91430 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

91431 pts/0 root fastq-dump Tue May 21 10:01:44 2019 45:05

2 ps -ef和ps aux命令

ps -ef:标准格式显示进程

ps -aux:BSD格式显示进程

(base) pc@pc-System-Product-Name:/project/raw_fq$ ps -ef |head

UID PID PPID C STIME TTY TIME CMD

root 1 0 0 5月09 ? 00:00:08 /sbin/init splash

root 2 0 0 5月09 ? 00:00:00 [kthreadd]

root 3 2 0 5月09 ? 00:00:00 [rcu_gp]

root 4 2 0 5月09 ? 00:00:00 [rcu_par_gp]

root 6 2 0 5月09 ? 00:00:00 [kworker/0:0H-kb]

root 8 2 0 5月09 ? 00:00:00 [mm_percpu_wq]

root 9 2 0 5月09 ? 00:00:03 [ksoftirqd/0]

root 10 2 0 5月09 ? 00:01:04 [rcu_sched]

root 11 2 0 5月09 ? 00:00:00 [rcu_bh]

(base) pc@pc-System-Product-Name:/project/raw_fq$ ps aux|head

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.0 225888 6456 ? Ss 5月09 0:08 /sbin/init splash

root 2 0.0 0.0 0 0 ? S 5月09 0:00 [kthreadd]

root 3 0.0 0.0 0 0 ? I< 5月09 0:00 [rcu_gp]

root 4 0.0 0.0 0 0 ? I< 5月09 0:00 [rcu_par_gp]

root 6 0.0 0.0 0 0 ? I< 5月09 0:00 [kworker/0:0H-kb]

root 8 0.0 0.0 0 0 ? I< 5月09 0:00 [mm_percpu_wq]

root 9 0.0 0.0 0 0 ? S 5月09 0:03 [ksoftirqd/0]

root 10 0.0 0.0 0 0 ? I 5月09 1:04 [rcu_sched]

root 11 0.0 0.0 0 0 ? I 5月09 0:00 [rcu_bh]

USER:用户名

%CPU:进程占用的CPU百分比

%MEM:占用内存的百分比

VSZ:该进程使用的虚拟內存量(KB)

RSS:该进程占用的固定內存量(KB)(驻留中页的数量)

STAT:进程的状态

START:该进程被触发启动时间

TIME:该进程实际使用CPU运行的时间

top命令

详细见Linux18.2_top命令详解

top也可以看进程信息,与ps区别如下

ps看命令执行那刻的进程信息,top是持续监视,ctrl c退出

ps只是查看进程,而top还可以监视系统性能,如平均负载,cpu和内存的消耗

总体来说,

ps主要是查看进程的,尤其你关心的进程

top主要看cpu,内存使用情况,及占用资源最多的进程由高到低排序,关注点在于资源占用情况

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值