LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to kill a process, the best way possible. I have a vi on background (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-kill-a-process-the-best-way-possible-i-have-a-vi-on-background-917796/)

Foxbat1155 12-08-2011 04:08 PM

How to kill a process, the best way possible. I have a vi on background
 
I entered vi to view a file but exited without saving, and actually, I think that instead of quitting, I just minimized that process to the background, so to speak.

This is the jobs output at the moment of writing this thread:

Code:

[1]  Running                djview4 fortran_chapman_2003.djvu &  (wd: ~/Documents/pemacs/fortran)
[2]-  Stopped                vi pagina_chapman.txt  (wd: ~/Documents/pemacs/fortran/exercicios)
[3]+  Stopped                vi pagina_chapman.txt  (wd: ~/Documents/pemacs/fortran/exercicios)
[4]  Running                chromium-browser &  (wd: ~/Documents/pemacs/fortran/exercicios)

How should I kill process number 2 and 3?

Is there a preferable procedure to killing a process?

Should I use the kill command?

Is the process id the same process id that shows on htop (PID)?

Thankyou.

Foxbat1155 12-08-2011 04:14 PM

T
 
I would like to add that in my htop those jobs appear with a 'T' tag, which, in the help, means this process has been "traced/stopped".

Does this mean that the process still shows although it is not running or sleeping, and not using any memory? Or just that it is waiting to be killed?

Cheers.

Foxbat1155 12-08-2011 04:19 PM

ps
 
My current ps command output:

Code:

  PID TTY          TIME CMD
 2144 pts/0    00:00:01 bash
 2185 pts/0    00:01:07 djview4
 2241 pts/0    00:00:00 vi
 2245 pts/0    00:00:00 vi
 3183 pts/0    00:06:39 chromium-browse
 3185 pts/0    00:00:09 chromium-browse
 3187 pts/0    00:00:00 chromium-browse
 3206 pts/0    00:00:12 chromium-browse
 3315 pts/0    00:00:00 chromium-browse <defunct>
 3339 pts/0    00:00:05 chromium-browse
 3978 pts/0    00:02:52 chromium-browse <defunct>
 3985 pts/0    00:00:00 chromium-browse <defunct>
 5986 pts/0    00:00:05 chromium-browse <defunct>
 6035 pts/0    00:00:00 chromium-browse <defunct>
 6797 pts/0    00:00:01 chromium-browse <defunct>
 7432 pts/0    00:00:02 chromium-browse <defunct>
 7439 pts/0    00:00:00 chromium-browse <defunct>
 7495 pts/0    00:00:09 chromium-browse
 7516 pts/0    00:00:06 chromium-browse
 7630 pts/0    00:00:28 chromium-browse
 7654 pts/0    00:00:18 chromium-browse
 7904 pts/0    00:00:00 ps

The fact that the vi operations show here means they are still active in some way?

Foxbat1155 12-08-2011 04:28 PM

maybe_solved
 
I believe I have solved this issue, but I would like some peer confirmation anyways.

I used kill -9 pid

I have also used killall -9 for the remaining vi process.

They no longer show in the HTOP.

Thankyou.

lugoteehalt 12-08-2011 05:24 PM

The sort of naturally motivated thing to do is simple enter %2 to enter vi and then stop vi in the normal way with :q. Ditto %3. Killing things seems a bit aggressive.

Foxbat1155 12-09-2011 11:58 AM

Quote:

Originally Posted by lugoteehalt (Post 4545500)
The sort of naturally motivated thing to do is simple enter %2 to enter vi and then stop vi in the normal way with :q. Ditto %3. Killing things seems a bit aggressive.


Mr Lugo Sir, do you mean that %2 gives me access to process #2?

lugoteehalt 12-09-2011 03:18 PM

Quote:

Originally Posted by Foxbat1155 (Post 4546046)
Mr Lugo Sir, do you mean that %2 gives me access to process #2?

Yes, just put %2 into a terminal and then hit <return> and that brings process 2 in the 'jobs' list to the foreground.

Try this to illustrate the point:
Code:

vim sillyStuff.txt

put in some text

hit ctrl+z  (to put it into the background, don't know if my usage of this term strictly correct)

jobs

%1  (and you are back into vim)


Foxbat1155 12-10-2011 02:11 PM

Thankyou.
 
Quote:

Originally Posted by lugoteehalt (Post 4546174)
Yes, just put %2 into a terminal and then hit <return> and that brings process 2 in the 'jobs' list to the foreground.

Try this to illustrate the point:
Code:

vim sillyStuff.txt

put in some text

hit ctrl+z  (to put it into the background, don't know if my usage of this term strictly correct)

jobs

%1  (and you are back into vim)


Thankyou for your help.


All times are GMT -5. The time now is 10:12 AM.