How to get a specific PID #
Ralf Mardorf
silver.bullet at zoho.com
Wed Dec 30 04:15:58 UTC 2015
On Tue, 29 Dec 2015 18:54:09 -0800, rikona wrote:
>I ran ps aux|head -n1;ps aux | grep -v grep | grep kate
>
>but no file names are shown. And, ONE instance of kate may have 3-5
>files open. Can xfw have multiple files open? If so, are all open file
>names shown?
File names are only shown by htop and ps aux, if a program was launched
with the file.
>> IOW instead of opening kate and then selecting a file, open a file
>> manager, select a file and open it with kate.
>
>That's mostly what I do, but sometimes just drag/drop in an open kate.
>Why does the method of opening a file make a difference? I'm running
>Ubuntu, and kate is a KDE thing - does that make a difference?
The difference is that htop and ps aux show how the command was launched,
they don't log what you're doing after they're launched.
They show the options that were used to launch a program:
$ spacefm -n --no-desktop & ps aux|grep -v grep|grep spacefm
[1] 26085
rocketm+ 26085 0.0 0.2 310216 9572 pts/0 R 04:28 0:00 spacefm -n --no-desktop
All options and/or files are shown:
$ pluma .jackdrc .bashrc & ps aux|grep -v grep|grep pluma
[1] 26047
rocketm+ 26047 0.0 0.1 177360 5176 pts/0 R 04:14 0:00 pluma .jackdrc .bashrc
If you launch an editor, e.g. pluma by a file manager or MUA, a variable
is used, e.g.
pluma %f
htop and ps aux then would show the path and file name, not the variable,
since the variable is the path and file name.
wmctrl could show you which window belongs to what PID.
List windows and their PIDs:
$ wmctrl -lp
0x00800003 0 17242 archlinux Rocketmouse - Claws Mail 3.13.1
0x01400012 0 17244 archlinux KDE+Ubuntu+ - Evolution
0x01a00003 0 17294 archlinux Unknown Crewman - Sylpheed 3.4.3
0x00a00003 -1 25836 archlinux panel
0x00e0001d -1 25835 archlinux panel
0x01c00007 0 26009 archlinux rocketmouse at archlinux:~
0x00860664 0 17242 archlinux Re: How to get a specific PID # - Compose message [Edited]
0x01e00114 0 26506 archlinux Unsaved Document 1 - Pluma
0x02600110 0 26515 archlinux Unsaved Document 1 - Pluma
Change the window title bar text of the pluma instances:
$ wmctrl -i -r 0x01e00114 -N "Pluma 1"
$ wmctrl -i -r 0x02600110 -N "Pluma 2"
Take a look at the window title bars, to see what Pluma instance you want
to kill and what to keep and get it's PID:
$ wmctrl -lp
0x00800003 0 17242 archlinux Rocketmouse - Claws Mail 3.13.1
0x01400012 0 17244 archlinux KDE+Ubuntu+ - Evolution
0x01a00003 0 17294 archlinux Unknown Crewman - Sylpheed 3.4.3
0x00a00003 -1 25836 archlinux panel
0x00e0001d -1 25835 archlinux panel
0x01c00007 0 26009 archlinux rocketmouse at archlinux:~
0x00860664 0 17242 archlinux Re: How to get a specific PID # - Compose message [Edited]
0x01e00114 0 26506 archlinux Pluma 1
0x02600110 0 26515 archlinux Pluma 2
Kill just the instance you want to kill:
$ kill -9 26506
$ wmctrl -lp
0x00800003 0 17242 archlinux Rocketmouse - Claws Mail 3.13.1
0x01400012 0 17244 archlinux KDE+Ubuntu+ - Evolution
0x01a00003 0 17294 archlinux Unknown Crewman - Sylpheed 3.4.3
0x00a00003 -1 25836 archlinux panel
0x00e0001d -1 25835 archlinux panel
0x01c00007 0 26009 archlinux rocketmouse at archlinux:~
0x00860664 0 17242 archlinux Re: How to get a specific PID # - Compose message [Edited]
0x02600110 0 26515 archlinux Pluma 2
More information about the ubuntu-users
mailing list