LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2008, 10:23 AM   #1
sulekha
Member
 
Registered: Dec 2004
Location: India
Distribution: ubuntu 10.04 , centos 5.5 , Debian lenny, Freenas
Posts: 324

Rep: Reputation: 36
Question kill -9 -1


Hi all,

I was going through the book "Hacking Ubuntu" by Neil Krawetz

in this book it is said that never do kill -9 -1 as root.

in my office i tried this command as root on an RHEL4 machine

but there was'nt any system crash as i expected only the x-server got crashed, and the commands like ps, ls were n't giving any o/p.

my question why init process wasn't killed ?
 
Old 07-16-2008, 10:26 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Well, first of all, you should never do a kill -9, you should always try to kill a process gracefully. -9 is always the last resort.

As for killing init, pfft... you can't kill init from what I recall. That would just be stupid.
 
Old 07-16-2008, 03:46 PM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
but there was'nt any system crash as i expected
Linux is graceful. What did you expect, your computer to explode, with fireworks?
Quote:
the commands like ps, ls were n't giving any o/p.
No, they are not giving any output, because they do not exist.

Last edited by tredegar; 07-16-2008 at 04:26 PM.
 
Old 07-16-2008, 04:17 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally Posted by tredegar View Post
echo sulekha >> ~/linux/LQ_idiots
That's not very nice.
 
Old 07-16-2008, 04:26 PM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
That's not very nice.
You are right. I was in a bad mood. It's deleted.
Thanks.
 
Old 07-16-2008, 06:29 PM   #6
kenoshi
Member
 
Registered: Sep 2007
Location: SF Bay Area, CA
Distribution: CentOS, SLES 10+, RHEL 3+, Debian Sarge
Posts: 159

Rep: Reputation: 32
Sulekha,

kill -9 -1 kills all processes owned by the user executing it, except for the shell you executed it from, with exception to root users.

Historically its used by non-root users to clean up after themselves, typically before logoff.

If you are logged in as root and run kill -9 -1 however, only root processes blocking SIGKILL (e.g. kernel threads) will remain. Everything else that belongs to root, including most daemons spawned through runlevel 1 - 5 such as dhclient, sendmail, sshd (you just booted everyone), ntpd, etc, will be killed.

On Redhat/CentOS systems, at runlevel 5 mingetty will be respawned to set up tty 1 - 6. Then the chosen/preferred desktop manager will be respawned via prefdm. Therefore it'll appear as if X server crashed and restored itself.

But if you look at processes closely, you'll see that nothing else is running except for the ttys, kernel threads, and bunch of desktop/gui processes.

This is one of the many many many many reasons why root access should be restricted...I've got horror stories about this one. Sometimes you just gotta learn the hard way I guess...

kill -9 1 doesn't work on Linux...its an old Solaris thing if memory serves.

Last edited by kenoshi; 07-16-2008 at 06:34 PM.
 
  


Reply



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
What if 'kill -9' fails to kill a task? chii-chan Linux - Newbie 15 03-27-2013 03:47 PM
how to use kill to kill a batch of processes with same name? dr_zayus69 Linux - Software 2 09-03-2005 06:35 PM
Kill command could not kill Kanaflloric Linux - General 11 08-22-2005 07:18 AM
cannot kill process (kill -9 does not work) mazer13a Linux - General 1 05-27-2005 02:32 PM
kill X = kill computer! jd243 Slackware 3 07-01-2003 11:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:31 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration