10

Suppose for example vlc media player is running and some directory is also opened in file browser. Now I want to close either the file browser or vlc.

One way can be to just click on the cross button on the top left hand corner, but how can I do this using terminal commands?

Charles Green
  • 20,952
  • 21
  • 60
  • 92
Priyansh Saxena
  • 101
  • 1
  • 1
  • 4

1 Answers1

14

Now every file is handled by another program say gedit and folders the same, so to kill [ the program handling that file or folder ] we can use two methods:

  1. The program name with:

    pkill <name_of_program>
    
  2. use of program PID (process id)

    • find the PID with pgrep <name_of_program>, then
    • kill it with kill <PID>

Information:

man pkill
man kill

Note: When closed this way any unsaved changes will be lost.

George Udosen
  • 35,970
  • 13
  • 99
  • 121
  • 1
    They want the same behavior as clicking "on the cross button on the top left hand corner", which isn't `-9`, since `-9` doesn't give the program the opportunity to close properly like clicking the "cross button". – Chai T. Rex May 27 '17 at 19:36
  • @Chait.rex now assuming user has saved their files and kills the app would there be anything wrong in that? – George Udosen May 27 '17 at 19:52
  • @ChaiT.Rex It can be useful when for example program doesn't respond in the GUI and clicking the cross button doesn't close it. – theAlexandrian Jul 25 '18 at 06:12