19

I am using a scratch file for some Kotlin work.

  • I accidentally created an endless loop in one of my functions and ran the file, so Intellij is not responding.

  • There is no button for stopping the execution of the scratch file and even if there were, that wouldn't work because Intellij is not responding to mouse clicks.

How do I force stop or restart Intellij in this case?

MalaKa
  • 3,734
  • 2
  • 18
  • 31
salyela
  • 1,325
  • 3
  • 14
  • 26

5 Answers5

26

You can kill the process by name using

pkill -9 intellij

or by

killall -9 intellij

or even

kill -9 $(ps aux | grep intellij | awk '{print $2}')
Yair Halberstadt
  • 5,733
  • 28
  • 60
rgen3
  • 657
  • 5
  • 10
  • 2
    Didn't work for me, but `pkill -9 java` or `killall -9 java` respectively did. Use with care at own responsibility. – Cadoiz Mar 03 '22 at 12:11
8

You first need to find Intellij's process id:

ps -f | grep -i intellij

and then kill the process id (PID):

kill -9 PID
Giorgos Myrianthous
  • 36,235
  • 20
  • 134
  • 156
4

Already good answers are given above.

Another great way to find IntelliJ PID is to use htop command on Linux.

  1. Install htop with the command: sudo apt install htop
  2. Run htop in terminal
  3. In the tabular format, PID is associated with each process including IntelliJ.
  4. Run kill -9 <pid_of_intellij> to kill the IntelliJ process.
Gaurav
  • 296
  • 1
  • 6
  • 21
2

You can use xkill then move the cursor from X to the window you need for example with (ide) This works provided that you are not completely frozen OS

AyupovFN
  • 21
  • 3
1

I tried with intellij but it doesn't work. On my ubuntu this command is working pkill -9 idea

mflorczak
  • 264
  • 3
  • 10