I can't close the IntelliJ IDEA when it hangs, how can I close it from the terminal?

P.S.: I think this question is different from "How to kill a unresponsive program from terminal?" because IntelliJ's process has name just 'java' so you can't really tell it apart by its name.

  • In the System Monitor application you can clearly see which process belongs to IntelliJ IDEA. It's the process that has the IntelliJ IDEA icon to the left of it. Under the circumstances this seems to be an easier way to close IntelliJ than closing it from the terminal.
    – karel
    Aug 3 '16 at 8:14
  • I agree. But in the terminal you can't see it
    – frostman
    Aug 3 '16 at 8:16
  • 2
    It doesn't matter because IntelliJ is a GUI app, so you can easily open the System Monitor too instead of the terminal. I have a custom keyboard shortcut for quickly opening my System Monitor. Even though this comment is not an answer within the constraints of your question, it should be an answer anyway IMO because it's a much easier way to do it.
    – karel
    Aug 3 '16 at 8:18
  • 1
    An easier way would be askubuntu.com/questions/19869/… – no terminal required like @karel suggests Aug 3 '16 at 9:44

It's running as a java process so you can use

killall java -9 

(Warning! This command kills all java processes)

Source: Intellij support forum

  • 8
    It would be safer to only kill java processes from IntelliJ's bundled JVM, e.g. killall /opt/intellij/jre64/bin/java. You can find the full path to a running IntelliJ's java process with ps -eo command | grep java | awk '{ print $1 }'. Apr 16 '19 at 11:23
  • This worked for me excellently. Thank you. Aug 22 '19 at 14:50
  • You should try killall java first Mar 19 '21 at 16:52

You can list all processes with

ps aux

and you can search processes with

pgrep <process name>

Then you can kill the process you want with

sudo kill -KILL <pid>

You can read more about it here

Not the answer you're looking for? Browse other questions tagged or ask your own question.