how to close "any" application cleanly from command line
My Redhat release: CentOS release 5.3 (Final)
Question: Sometimes i open so many 'nedit'(editor application) windows and i have to close all of them one by one. I want to close all of them from the command line. But i donot want to use 'kill' since that will forcibly terminate without saving the file(if i want to). Is there any way we can run from command line to close an application but prompting me to save if it is not saved. In short, i want a command line equivalent of 'moving the mouse and clicking 'X' on the window |
xprop gives the PID of that process
you can send a HUP to that PID. But the process of exiting an application gracefully is totally application dependent and is handled by each application in its own manner. Many do not support HUP signals and it will just crash the program. Some others will respond to USR1 signal. _NET_WM_PID is the xprop which gives the PID of that running process |
You can try wmctrl. It can send a graceful close command to X applications. The only problem is that it select open X applications based on the window title, not on the application name. Luckily you can modify the appearance of the windows title in the Nedit preferences, so that a uniquely identified string can be a valid fingerprint for the application you want to close.
In Nedit go to Preferences --> Default Settings --> Customize Window Title. In the Format box you can write any string. For example if you choose: Code:
Nedit: {%c} [%s] %f (%S) - %d Now to quit a nedit X window you can do Code:
wmctrl -c Nedit Code:
xquit () Code:
xquit Nedit |
Thanks for the reply.
I donot find wmctrl as part of redhat release that i have. |
It is provided by the RPMforge repository (direct download here).
|
you can use < ctlr> + <c>
that will kill the current running command |
All times are GMT -5. The time now is 03:54 PM. |