How do I get the full command line for an X application via "wmctl" and "ps"?


User 8590543

I'm working on a program that queries a running X application, saves all the running application's commands, and then reopens them.

I encountered a problem. wmctctl can query the PID of Onlyoffice , for example the PID is 123, and then run ps -ef -q 123, I see CMD is ./DesktopEditorsthis should be an invalid command, because ./one_commandonly work in special folders includes the file one_command.

I can get the full command by running ps -ef -q $(pgrep -P 123).

Is there a direct way to pass wmctland get the full command to Onlyoffice ps?

If there is a better way to get all the commands of an X application please let me know. thanks.

Doodle boy

I recommend using ps -h -e -o pid,argsthe command with a pipegrep

This should provide the full command path with arguments and options.

For example, to find all running java programs and their arguments (possibly extensive):

ps -eo pid,args | grep java

In your case I would suggest a small awk script that looks for the pid given as the third input field in the current line:

wmctrl -l -p|awk '{system("ps -h --pid "$3" -o args")}'

Sample output

nautilus-desktop --force
/usr/libexec/gnome-terminal-server
/usr/libexec/gnome-terminal-server

renew

Convert the current directory ./to a full path. It is assumed ./to represent the current working directory. Add the following pipeline.

wmctrl -l -p|awk '{system("ps -h --pid "$3" -o args")}'|sed "s|^\./|$PWD/|"

DesktopEditorsTo find a script or program on your computer , use find / -name "DesktopEditors".

But I believe it's useless if you're trying to reverse engineer a web-based application that requires some kind of browser emulator.

Related


ps cut command, how to get full

Gutley The command line gets cut if I run: user@host:~$ ps -eo pid,cmd,lstart output: 6382 /home/user/bin/pyt Sun Oct 22 18:51:39 2017 How can I get the entire command (including all parameters)? Version: procps-ng version 3.3.5 Ipor siren Swap columns: ps -

ps cut command, how to get full

Gutley The command line gets cut if I run: user@host:~$ ps -eo pid,cmd,lstart output: 6382 /home/user/bin/pyt Sun Oct 22 18:51:39 2017 How can I get the entire command (including all parameters)? Version: procps-ng version 3.3.5 Ipor siren Swap columns: ps -

ps cut command, how to get full

Gutley The command line gets cut if I run: user@host:~$ ps -eo pid,cmd,lstart output: 6382 /home/user/bin/pyt Sun Oct 22 18:51:39 2017 How can I get the entire command (including all parameters)? Version: procps-ng version 3.3.5 Ipor siren Swap columns: ps -

How do I get C:/ on the command line

username I am on Windows 10. I'm trying to load Adobe Dreamweaver extension via command line on Windows. I want to navigate to C:\Program Files\Adobe\Adobe Extension Manager CSx\ I am following the instructions here . If I select command prompt (admin), I getC

How do I get C:/ on the command line

username I am on Windows 10. I'm trying to load Adobe Dreamweaver extension via command line on Windows. I want to navigate to C:\Program Files\Adobe\Adobe Extension Manager CSx\ I am following the instructions here . If I select command prompt (admin), I getC

How do I do this deployment via the command line

Kirk Strobeck I can deploy like this, but not from the command line. I've been imagining this kubectl create -f kubernetes-rc.json { "kind": "ReplicationController", "apiVersion": "v1", "metadata": { "name": "foo-frontend-rc", "labels": {

How do I do this deployment via the command line

Kirk Strobeck I can deploy like this, but not from the command line. I've been imagining this kubectl create -f kubernetes-rc.json { "kind": "ReplicationController", "apiVersion": "v1", "metadata": { "name": "foo-frontend-rc", "labels": {

How do I do this deployment via the command line

Kirk Strobeck I can deploy like this, but not from the command line. I've been imagining this kubectl create -f kubernetes-rc.json { "kind": "ReplicationController", "apiVersion": "v1", "metadata": { "name": "foo-frontend-rc", "labels": {

How do I do this deployment via the command line

Kirk Strobeck I can deploy like this, but not from the command line. I've been imagining this kubectl create -f kubernetes-rc.json { "kind": "ReplicationController", "apiVersion": "v1", "metadata": { "name": "foo-frontend-rc", "labels": {

How do we get the command line of a running application?

Radu Rădeanu In Ubuntu, applications can be opened from the terminal. But sometimes it's not clear what the proper command to do this is. So, after opening the app, how do I get the command to launch it without having to search everywhere (just by looking)? Ra

How do we get the command line of a running application?

Radu Rădeanu In Ubuntu, applications can be opened from the terminal. But sometimes it's not clear what the proper command to do this is. So, after opening the app, how do I get the command to launch it without having to search everywhere (just by looking)? Ra

How do we get the command line of a running application?

Radu Rădeanu In Ubuntu, applications can be opened from the terminal. But sometimes it's not clear what the proper command to do this is. So, after opening the app, how do I get the command to launch it without having to search everywhere (just by looking)? Ra

How can I get the command line of a running application?

remain For example notepad this.txt, if I have a program open , how do I get the full command line for this application, including the arguments used to start the program? Ideally, I'd like a method that supports copying, since this command is long. remain I f

How can I get the command line of a running application?

remain For example notepad this.txt, if I have a program open , how do I get the full command line for this application, including the arguments used to start the program? Ideally, I'd like a method that supports copying, since this command is long. remain I f

How do I get the command line that starts the process

velvet: From Java, is it possible to get the full command line with all the arguments to start the application? System.getEnv()and System.getProperties()doesn't seem to contain these values. Stephen Denne: Some of these are available from RuntimeMXBean by call

How do I get the Windows version using the command line?

Yoder If I am in CMDI can usewinver I can see my OS version is 20H2now. But this is GUI result and I want to use command line to make it. if i use ver Microsoft Windows [Version 10.0.19042.868] If I'm in powershell, I can use Get-ComputerInfo WindowsVersion

How do I get the command line that starts the process

velvet: From Java, is it possible to get the full command line with all the arguments to start the application? System.getEnv()and System.getProperties()doesn't seem to contain these values. Stephen Denne: Some of these are available from RuntimeMXBean by call

How do I get Cj to send newlines in the tmux command line?

Sam I'm already a big fan of using C-jinstead of <ENTER>sending newlines. Unfortunately, in the tmux command line ( which is invoked by prefix-:default ) C-j, even set -gw status-keys emacsputting in does nothing ~/.tmux.conf. (Note that it C-jsends newlines f

How do I get the command line that starts the process

velvet: From Java, is it possible to get the full command line with all the arguments to start the application? System.getEnv()and System.getProperties()doesn't seem to contain these values. Stephen Denne: Some of these are available from RuntimeMXBean by call

How do I get Cj to send newlines in the tmux command line?

Sam I'm already a big fan of using C-jinstead of <ENTER>sending newlines. Unfortunately, in the tmux command line ( which is invoked by prefix-:default ) C-j, even set -gw status-keys emacsputting in does nothing ~/.tmux.conf. (Note that it C-jsends newlines f