Total Pageviews

Friday 28 December 2012

杀死进程的另2个办法



Do you ever want to kill a process, but you do not know its process id? Then you look it up with ps ... Kind of teadious ... I have two solutions for you

# Solution 1 with KDE
apt-get install ksysguard
# go to /etc/inittab
# change ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now to
ca:12345:ctrlaltdel:/usr/bin/ksysguard --showprocesses
# reboot
# you press ctrl + alt + del, graphical tasklist show up, kill whatever you like

# Solution 2 with Bash
In your .bashrc, you put
function stab() {
  kill -9 `ps ax | grep $1 | awk '{print $1}'`
}
# quit your editor
. ~/.bashrc
# if you want to kill konqueror, you do
stab konqueror