What's the correct way to shutdown system while apt-get is still running? apt-get complains about unclean shutdown when I just shutdown computer.
As an elaboration on Piskvor's advice ("don't"), you could issue this command at the shell prompt:
The above assumes you're running as superuser.
The idea is to let apt-get finish before shutting down without your having to sit there waiting for it to end. You could write a more elegant script that, e.g., uses ps and grep to detect whether apt-get has completed, but I don't have access to a Linux box here at work to test such a script on.
Close apt-get first? Perhaps using an interrupt signal (^C if in foreground, otherwise
You can get a list of signals with
Before trying 9 (SIGKILL), the nuclear option, you can try gentler signals such as HUP, INT, QUIT, or maybe USR1, USR2 or ABRT. Really the program docs for apt-get ought to say if it handles any of these signals differently. As it doesn't I don't hold out a lot of hope. Some bug reports mentioned that INT should work.