I got so bored with doing ps aux and manual kill for closing a running KVM instance so I made this little nifty Python script to list all running KVM processes and allow killing them by index number.
Drop the code to /usr/local/bin/lskvm and make it executable:
wget http://pastebin.com/download.php?i=Ah9FRHu2 -O - -q |
sed "s/r//" - > /usr/local/bin/lskvm
chmod +x /usr/local/bin/lskvm
Run the command just by doing:
The output will be something like:
# PID MP Used Alloc Executable VNC User Disk
1 3247 2 266MB 256MB qemu-system-x86_64 kvm manpremo.bin
2 6382 4 1GB 1GB qemu-system-x86_64 :1 kvm debian-lenny.bin
3 10336 4 1GB 1GB qemu-system-x86_64 kvm nopidou.bin
The command prompt will be waiting for the user to enter index here in the first column for a process to be killed. Return or Control-C cancels the prompt.