lsof-org / lsof

LiSt Open Files
https://lsof.readthedocs.io
Other
432 stars 107 forks source link

Match on full commandline, not just the binary name #301

Open dyfrgi opened 11 months ago

dyfrgi commented 11 months ago

Apps built using the Electron framework may be packaged so that they have a commandline that looks something like /usr/bin/electron --app-path=/usr/local/appname/resources/app. Some other apps may also have a binary name that is different from the app name, e.g. /usr/bin/python or another interpreter. I would like to be able to match these sorts of apps directly with lsof.

As a workaround, it's possible to create a commandline by doing something along these lines: lsof -p $(ps aux | grep -i logseq | awk '{print $2}' | tr '\n' ','). Or on a system with pgrep available a shorter version is possible: lsof -p $(pgrep -f -d, -i logseq).