专栏首页云计算与大数据linux top ps grep 操作技巧mark

linux top ps grep 操作技巧mark

Press (Shift+O) to Sort field via field letter, for example press ‘a‘ letter to sort process with PID (Process ID).

Sorting Process ID’s with Top

Type any key to return to main top window with sorted PID order as shown in below screen. Press ‘q‘ to quit exit the window.

Sorting Process ID’s

3. Display Specific User Process

Use top command with ‘u‘ option will display specific User process details.

# top -u tecmint

Top with Specific User Processes

4. Highlight Running Process in Top

Press ‘z‘ option in running top command will display running process in color which may help you to identified running process easily.

Top Process with Colorful

5. Shows Absolute Path of Processes

Press ‘c‘ option in running top command, it will display absolute path of running process.

Top with Specific Process Path

6. Change Delay or Set ‘Screen Refresh Interval’ in Top

By default screen refresh interval is 3.0 seconds, same can be change pressing ‘d‘ option in running top command and change it as desired as shown below.

Top – Set Refresh Time

7. Kill running process with argument ‘k’

You can kill a process after finding PID of process by pressing ‘k‘ option in running top command without exiting from top window as shown below.

Top – Kill Process ID

8. Sort by CPU Utilisation

Press (Shift+P) to sort processes as per CPU utilization. See screenshot below.

Top – High CPU Utilization

9. Renice a Process

You can use ‘r‘ option to change the priority of the process also called Renice.

Top – Renice Process

10. Save Top Command Results

To save the running top command results output to a file /root/.toprc use the following command.

# top -n 1 -b > top-output.txt

Top Command Save Results

11. Getting Top Command Help

Press ‘h‘ option to obtain the top command help.

Top Command Help

12. Exit Top Command After Specific repetition

Top output keep refreshing until you press ‘q‘. With below command top command will automatically exit after 10 number of repetition.

# top -n 10

There are number of arguments to know more about top command you may refer man page of top command. Please share it if you find this article useful through our comment box below.

https://www.tecmint.com/12-top-command-examples-in-linux/

ps 命令查看进程启动的精确时间和启动后所流逝的时间

lstart      STARTED   time the command started.  See also bsdstart, start, start_time, and stime.
etime       ELAPSED   elapsed time since the process was started, in the form [[DD-]hh:]mm:ss.

ps -eo pid,lstart,etime,cmd | grep java

grep 命令过滤配置文件中的注释和空行

grep -Ev "^$|^[#;]" server.conf

本文分享自微信公众号 - 黑洞日志(heidcloud),作者:砥砺前行不负韶华

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2019-05-27

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • 运维:记录因grpc需求而引发的glibc故障

    提示glibc版本有问题,然后打算升级,glibc.结果把/lib64/libc.so.6 给替换了,造成Linux ssh无法远程登录,bash命令无法执行。

    heidsoft
  • 分布式事务中间件 Fescar - RM 模块源码解读

    在SOA、微服务架构流行的年代,许多复杂业务上需要支持多资源占用场景,而在分布式系统中因为某个资源不足而导致其它资源占用回滚的系统设计一直是个难点。我所在的团队...

    heidsoft
  • mac route flag 含义

    https://apple.stackexchange.com/questions/336888/whats-the-meanings-of-the-routi...

    heidsoft
  • 打不死的比特币ETF申请到底有多难?美国证监会再次拒绝比特币ETF

    北京时间周四(8月23日)消息,据外媒报道,美国证券交易委员会(SEC)周三驳回了9只基于比特币的ETF基金的申请,再次挫败了基于这种波动剧烈的加密货币构建ET...

    币聪财经
  • How to Keep Environment Variables and PATH When Using SUDO

    happy123.me
  • 电商平台的关键竞争力究竟是什么?疫情期见真章

    电商行业的关键竞争力是什么?对于这一问题,人们以前争论不休,没有共识:有人说是物流,京东崛起正是因为刘强东很早认识到物流重要性并大力布局;有人说是流量,因为电商...

    罗超频道
  • Flex布局

    一般的网页布局,都是和模型布局,要想把行标签和块标签一排布局,一般都用display: inline-block、或者是浮动float。但是这两...

    wade
  • java架构之路-(Redis专题)简单聊聊redis分布式锁

      这次我们来简单说说分布式锁,我记得过去我也过一篇JMM的内存一致性算法,就是说拿到锁的可以继续操作,没拿到的自旋等待。

    小菜的不能再菜
  • Python计算序列中数字最大差值(美团2016校招笔试题)

    题目要求:给定一个包含若干数字的序列A(本文以列表为例),求满足0≤a≤b<n(其中n为序列长度)的A[b] - A[a]的最大值。 编程要点:循环结构用法,切...

    Python小屋屋主
  • if exists table drop table ORACLE 存储过程

    CREATE OR REPLACE PROCEDURE DROPEXITSTABS (TAB_NAME_IN IN varchar2) IS v_...

    用户5640963

扫码关注云+社区

领取腾讯云代金券