LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-08-2011, 04:08 PM   #1
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Rep: Reputation: 0
Smile 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.
 
Old 12-08-2011, 04:14 PM   #2
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Original Poster
Rep: Reputation: 0
Smile 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.
 
Old 12-08-2011, 04:19 PM   #3
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Original Poster
Rep: Reputation: 0
Smile 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?
 
Old 12-08-2011, 04:28 PM   #4
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Original Poster
Rep: Reputation: 0
Smile 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.
 
Old 12-08-2011, 05:24 PM   #5
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
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.
 
1 members found this post helpful.
Old 12-09-2011, 11:58 AM   #6
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by lugoteehalt View Post
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?
 
Old 12-09-2011, 03:18 PM   #7
lugoteehalt
Senior Member
 
Registered: Sep 2003
Location: UK
Distribution: Debian
Posts: 1,215
Blog Entries: 2

Rep: Reputation: 49
Quote:
Originally Posted by Foxbat1155 View Post
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)

Last edited by lugoteehalt; 12-09-2011 at 03:26 PM.
 
1 members found this post helpful.
Old 12-10-2011, 02:11 PM   #8
Foxbat1155
Member
 
Registered: Oct 2011
Location: Portugal.
Distribution: Debian squeeze - Fluxbox.
Posts: 109

Original Poster
Rep: Reputation: 0
Smile Thankyou.

Quote:
Originally Posted by lugoteehalt View Post
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.
 
  


Reply

Tags
jobs, kill


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to kill or clean a Uninterruptible slept session leader process from process tabl golden_boy615 Linux - General 1 12-14-2010 10:47 AM
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 09:42 AM
How to get the PID of the process giving kill signal to a process? hariprd Programming 2 11-27-2008 03:10 AM
Shell Script : Kill a running process when another process starts ashmew2 Linux - General 3 08-20-2008 03:47 AM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM


All times are GMT -5. The time now is 03:35 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration