2. Linux常用命令

2019-04-01  本文已影响0人  fcbhank

此部分主要考察java从业者的线上问题排查能力,现基于CentOS release 6.5 (Final)简要介绍如下6个命令[1],期间用poem文件举例。推荐查询linux命令的两个网址Linux 命令大全 | 菜鸟教程Linux命令大全(手册)

cat poem
******结果******
1 --------------------------
2 The Noon Balloon
3 Will be leaving soon
4 For the sun or the moon.
5 And wherever it goes,
6 It will get there too soon.
7 --------------------------
awk 'NR>=2 && NR<=6 {print $2"#"$4"#"$1*10}' poem
******结果******
The#Balloon#20
Will#leaving#30
For#sun#40
And#it#50
It#get#60

e.g. 每隔3秒批次查看进程号为1673的进程3次,然后结束。
top -d 3 -b -n 3 -p 1673

top命令执行结果.gif
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        0      1 node4:42278                 node1:intu-ec-svcdisc       SYN_SENT    
tcp        0      1 node4:59492                 node2:intu-ec-svcdisc       SYN_SENT    
tcp        0      0 node4:ssh                   192.168.226.1:56589         ESTABLISHED 
tcp        0    132 node4:ssh                   192.168.226.1:53859         ESTABLISHED 
tcp        0      0 node4:8031                  node4:32834                 ESTABLISHED 
tcp        0      1 node4:44307                 node1:eforward              SYN_SENT    
tcp        0      0 node4:32834                 node4:8031                  ESTABLISHED 
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  14     [ ]         DGRAM                    11626  /dev/log
unix  2      [ ]         DGRAM                    9228   @/org/kernel/udev/udevd
unix  2      [ ]         DGRAM                    12430  @/org/freedesktop/hal/udev_event
…(省略)…
2:2 The Noon Balloon
3:3 Will be leaving soon
6:6 It will get there too soon.
tail -n 2 poem
******结果******
6 It will get there too soon.
7 --------------------------

  1. 鸟哥. 鸟哥的Linux私房菜[M]. 北京: 人民邮电出版社, 2016.

上一篇 下一篇

猜你喜欢

热点阅读