对控制台程序,通过pgrep很容易查到程序的 pid,通过pkill也可以杀掉它。
如果XWin程序跑飞了,用pgrep就不容易定位,比如java程序,系统里一大堆java进程,不知道哪个对应哪个窗口。此时可以使用,xwininfo
和 xkill
命令。
-
xwininfo
命令运行后,用鼠标点击一下窗口,会在控制台打印对应的x窗口的信息,比如:
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x1a00053 "tests – PlaceContractCest"
Absolute upper-left X: 1920
Absolute upper-left Y: 0
Relative upper-left X: 0
Relative upper-left Y: 0
Width: 2560
Height: 1440
Depth: 24
Visual: 0x21
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +1920+0 -0+0 -0-0 +1920-0
-geometry 2560x1440-0+0
- 用
xkill
命令杀掉他:
$ xkill -id 0x1a00053
xkill: killing creator of resource 0x1a00053
此处的id
,即 xwininfo 输出的 Windows id
.
网友评论