How do I stop apt-get when it's running? [closed]

When I want to remove a program, sometimes I get an error telling me to wait until apt-get stops running, but it doesn't; no matter how long I wait I get the same error. So I have restart the computer.

Is there a way to stop the apt-get process?


If you wish to:

  • End a process do: CTRL + C
  • Kill a process do: CTRL + U

Though you should note that interrupting apt-get/apt in the middle of a package installation or removal can cause problems later on and could even corrupt your system and make it unbootable (depending on the package) so it is something which is highly inadvisable to do.

Especially by just powering down your system, that is total interruption of what it is doing, at least with the end shortcut the program can choose what to do in such a circumstance and may have a cleaner exit which allows it to resume later on (so it may take a few moments for this shortcut to work, please be patient at least for this).

If you wish later on to resume apt-get you may run either of these commands:

  • sudo apt-get install -f
  • sudo dpkg --configure -a

Ctrl + C will simply send a SIGINT signal to apt-get which will by default cause process to terminate. Also, I don't recommeded you to do this.

(Not recommdend in any scenarios)Ctrl+\ will allow you to send SIGQUIT signal to apt-get which force the process to terminate and create a dump.

If network drops , you should use Ctrl + Z to suspend the process in the background and then use fg %1 (%x , value of x can be different).

Also, if you are getting too much time taken by apt-get then you should remove/deactivate some of the PPAs you don't require using software updates program. (I have personally deactivated webup8 PPA because I don't want upgrade a higher Oracle JDK version.) After, deactivating PPAs, apt-get will ignore deactivated PPAs.

Note: Removing PPAs should be handled with care.

enter image description here