LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   kill command, fed 17 (https://www.linuxquestions.org/questions/fedora-35/kill-command-fed-17-a-4175425524/)

ronss 09-04-2012 01:26 AM

kill command, fed 17
 
wanted to kill the gnome terminal i was on...i decided to use the kill command from the terminal, and i used the pid number for my gnome terminal, got it from the top command.., and priority 1 , and used the -s option,....kill -s......it killed the gnome terminal i was using, but it also eliminated my tabs ontop of the desktop, so i could not get into the terminal again....when i rebooted, it complete changed the gnome desktop, back to where the menu was years ago...i was using fed 17.....what happen, and how do i get fed 17 back to default dektop...

tronayne 09-04-2012 11:38 AM

Killing huge applications (like GNOME or KDE) can be a tricky proposition; they launch any number of child processes and plain old programs when running.

You can try the old-fashioned kill the window manage:
Code:

ctrl-alt-shift-backsapce
and you might get lucky.

Using kill -s TERM PID will generally terminate parent and child processes -- but not always (as you have found). This is simply because the window manager has launched so many applications.

Something you can do is use the ps utility to find all the PIDS your user id has running; e.g.,
Code:

ps -ef | grep userid
Those PIDs will the the ones you want to terminate (although you're probably going to get to a black-screen console when you do). And, you want to terminate them in reverse order. So you could do something like this:
Code:

ps -ef | grep userid | sort -r
That give you a list in reverse order, which is pretty useless, so you would want to do something like this
Code:

for pid in $(ps -ef | fgrep userid | sort -r | awk '{ print $2 }')
do
    kill -s TERM ${pid}
done

That will be messy, but you're only going to terminate the PIDs you own, not the system-launched ones (so, you know, don't do this as root). And, if the thing is so screwed up that you can not exit from GNOME to begin with you may be stuck with hitting the power button.

Another way, if you've completely lost control of the window manager and can't terminate it but can get a terminal window open is to
Code:

su - (or sudo)
init 1

That will put the system (gently) into single user mode from which you can reboot cleanly with
Code:

log out and back in as root, use su - or sudo
init 6

You could also do init 6 rather than going into single user first.

How to get back the default desktop in GNOME, I don't know (never have and do not now use it). It it were KDE, there are a couple of .kde* directories in your home directory; you simply delete them, log out or restart X and you'll have the default KDE display back (then, you get to completely re customize it, oh, joy). There's probably the same thing in GNOME, just do an ls -al in your home directory and see what you've got. In either case, when you restart or log out and back in again the window manager will not find those directories and should prompt you though initial set up.

This is where it's a good idea to keep a copy of those configuration directories off somewhere or other so you can recover your configuration is Something Bad Happens -- some directory (not your home), a flash drive, a CD-ROM, whatever.

Anyway, this is going to be messy so don't be in a big hurry to fix it, stop and think before you do something, eh?

Hope this helps some.


All times are GMT -5. The time now is 06:28 AM.