0

I was running gedit from the command window for editing an xml file. After editing the file, I closed the gedit text editor window.

But the gedit process was till running in the command window. So I forced stopped it using ctrl+z.

After that I want to use gedit to open another file. How-long-so-ever I try, gedit xxxx.xml, gedit is not responding.

Can someone help me why it is not responding? And how to go forward?

  • 3
    <Ctrl+Z> is suspend for process, then you need to send it to background with bg. If you need to stop process, use <Ctrl+C>. – N0rbert Aug 3 '18 at 9:01
2

Find PID of gedit

Open a terminal, type for example ps -x (you can also use top, htop, ...) enter image description here

Here, we can that my gedit PID is 16694 (it's on the 1rst column on the left)

Force gedit to close

use the command kill -9 PID where PID is the number you find with ps -x. In my example, gedit PID was 16694, so I must type kill -9 16694

You can now restart gedit, the non-responding state is totally wiped out.

NB: kill command works even on program open with & or nohup option.

NB-2 : If you have some applications running, it could be hard to find the PID, so just add a grep command to find it like that :

ps -x | grep gedit
0

Ctrl+Z means suspending the process, so it continues to live but appears frozen. It is not terminated as Ctrl+C would do.

There are basically four options what to do with a process suspended in a terminal:

  • fg %<job> to continue it running in the foreground
  • bg %<job> to continue it running in the background (so you can issue further commands)
  • kill %<job> to terminate the process gracefully
  • kill -9 %<job> to terminate the process forcefully (can cause unsaved changes etc.)

<job> is to be replaced with the job number given by the shell in square brackets (it’s 1 in the following example):

$ sleep 30
^Z
[1]+  Stopped                 sleep 30
$ kill %1
$ # (enter any command or just press Enter to refresh the shell)
[1]+  Terminated              sleep 30
$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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