网络管理
nsenter
nsenter 命令是一个可以在指定进程的命令空间下运行指定程序的命令。
详见
网桥工具 bridge-utils
安装方式
Centos系统
yum install bridge-utils
Ubuntu系统
apt-get install bridge-utils
使用方式
Usage: brctl [commands]
commands:
addbr <bridge> add bridge
delbr <bridge> delete bridge
addif <bridge> <device> add interface to bridge
delif <bridge> <device> delete interface from bridge
hairpin <bridge> <port> {on|off} turn hairpin on/off
setageing <bridge> <time> set ageing time
setbridgeprio <bridge> <prio> set bridge priority
setfd <bridge> <time> set bridge forward delay
sethello <bridge> <time> set hello time
setmaxage <bridge> <time> set max message age
setpathcost <bridge> <port> <cost> set path cost
setportprio <bridge> <port> <prio> set port priority
show [ <bridge> ] show a list of bridges
showmacs <bridge> show a list of mac addrs
showstp <bridge> show bridge stp info
stp <bridge> {on|off} turn stp on/off
进程管理
pstree 进程树
使用方法
pstree --help
pstree: unrecognized option '--help'
Usage: pstree [-acglpsStTuZ] [ -h | -H PID ] [ -n | -N type ]
[ -A | -G | -U ] [ PID | USER ]
or: pstree -V
Display a tree of processes.
-a, --arguments show command line arguments
显示命令行参数
-A, --ascii use ASCII line drawing characters
使用 ASCII 划线字符
-c, --compact-not don't compact identical subtrees
不要压缩相同的子树
-C, --color=TYPE color process by attribute (age)
根据属性进行颜色处理(例如:age)
-g, --show-pgids show process group ids; implies -c
显示进程组id;也意味着执行了 -c
-G, --vt100 use VT100 line drawing characters
使用VT100划线字符
-h, --highlight-all highlight current process and its ancestors
突出显示当前进程及其祖先(会加粗)
-H PID, --highlight-pid=PID
highlight this process and its ancestors
突出指定 PID 的进程极其祖先(会加粗)
-l, --long don't truncate long lines
不要截断长行
-n, --numeric-sort sort output by PID
通过 PID 对输出进行排序
-N TYPE, --ns-sort=TYPE
sort output by this namespace type
(cgroup, ipc, mnt, net, pid, user, uts)
按此 namespace 类型对输出进行排序
-p, --show-pids show PIDs; implies -c
显示进程id;也意味着执行了 -c
-s [PID], --show-parents=PID show parents of the selected process
显示所选进程的父进程
-S, --ns-changes show namespace transitions
显示 namespace 的转换
-t, --thread-names show full thread names
显示完整的线程名称
-T, --hide-threads hide threads, show only processes
隐藏线程,只显示进程
-u, --uid-changes show uid transitions
显示 uid 的转换
-U, --unicode use UTF-8 (Unicode) line drawing characters
使用UTF-8 (Unicode)划线字符
-V, --version display version information
显示版本信息
-Z, --security-context
show SELinux security contexts
显示 SELinux 安全上下文
PID start at this PID; default is 1 (init)
起始进程 PID
USER show only trees rooted at processes of this user
只显示这个用户的进程
实例
➜ ~ pstree -apnht
# 只展示了一部分内容:
└─java,584183 -jar halo-1.4.16.jar
├─{java},584186
├─{GC Thread#0},584197
├─{G1 Main Marker},584198
├─{G1 Conc#0},584199
├─{G1 Refine#0},584200
├─{G1 Service},584201
├─{VM Thread},584202
├─{Reference Handl},584203
├─{Finalizer},584204
├─{Signal Dispatch},584205
├─{Service Thread},584206
├─{Monitor Deflati},584207
├─{C2 CompilerThre},584208
├─{C1 CompilerThre},584209
├─{Sweeper thread},584210
├─{Notification Th},584211
├─{VM Periodic Tas},584212
├─{Common-Cleaner},584213
├─{GC Thread#1},584214
├─{G1 Refine#1},584265
├─{qtp748006558-17},584267
├─{qtp748006558-19},584269
├─{qtp748006558-20},584270
├─{qtp748006558-21},584271
├─{qtp748006558-22},584272
├─{qtp748006558-23},584273
├─{Timer-0},584281
├─{mysql-cj-abando},584285
├─{MVStore backgro},584292
├─{HikariPool-1 ho},584293
├─{Session-HouseKe},584330
├─{HttpClient-1-Se},584366
├─{scheduling-1},584377
├─{Connector-Sched},584472
├─{Session-Schedul},584483
├─{qtp748006558-40},586105
├─{JGit-WorkQueue},586440
├─{pool-2-thread-1},587582
├─{pool-3-thread-1},587584
├─{logback-1},596772
├─{logback-2},596773
├─{qtp748006558-51},597095
├─{logback-3},614204
├─{logback-4},614205
├─{logback-5},625030
├─{logback-6},625031
├─{logback-7},634143
├─{logback-8},634144
├─{Java2D Disposer},672583
└─{pool-3-thread-2},672832
评论区