How can I detect in Lubuntu the command line invocation of a process from one of its windows, so that I can run it later from the command line?

  • I'm not sure what you asking about but you might be asking about xprop. Jan 9 at 22:09
  • Could you provide an example of what you are trying to achieve? Jan 9 at 22:19
  • On Raspbian I can open the "GUI Network Dialog" by clicking the right mouse on the Network Widget on the Taskbar. In need to know how to open that network dialog from commandline. Jan 9 at 22:19
  • I don't quite understand. Are you trying to run Windows programs from your command line while being booted into Lubuntu? Jan 9 at 23:31

You can combine a couple of commands:

$ cat /proc/$(xprop | grep PID | awk '{print $3}')/cmdline | tr '\0' ' ';echo

xprop will wait until you click on a window. When you do, it prints the process id number and other info (grep and awk clean that up) and cat shows the file /proc/cmd/PID/cmdline which holds the command line, with arguments, but uses zero as separator. Then with tr you the zero caracters into spaces. A final echo leaves the output in its own line.

This is not meant to be performant but, hopefully, readable.

You can also call ps with the flags you need, in order to get information on the process:

$ ps FLAGS -p $(xprop | grep PID | awk '{print $3}')
  • Ok. Thank you. I will try to use this Information. Jan 11 at 13:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.