hi, i want to close any internet browser running on linux through terminal. how to do this ? and how to implement in java code?

Recommended Answers

Here is an example session in my terminal

15:26 atelier] ps aux | grep firefox
eric      2547  1.6  7.5 1484500 305384 ?      Sl   12:44   4:40 /usr/lib/firefox/firefox --sm-config-prefix /firefox-iWhUk7/ --sm-client-id 1017a158179130000142325992000000022580029 --screen 0
eric      7843  0.0  0.0  14556   928 pts/22   S+   17:32   0:00 grep --color=auto firefox
17:32 atelier] kill -2 2547 …
Jump to Post

All 2 Replies

Here is an example session in my terminal

15:26 atelier] ps aux | grep firefox
eric      2547  1.6  7.5 1484500 305384 ?      Sl   12:44   4:40 /usr/lib/firefox/firefox --sm-config-prefix /firefox-iWhUk7/ --sm-client-id 1017a158179130000142325992000000022580029 --screen 0
eric      7843  0.0  0.0  14556   928 pts/22   S+   17:32   0:00 grep --color=auto firefox
17:32 atelier] kill -2 2547
17:32 atelier] 

If I had to do it programmatically, I would probably do it in python using the psutil module to find the processes and send them kill signals. I don't know how to do it directly in java.

Or more simply, "killall firefox"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.