como desinstalar facilmente os pacotes listados no histórico?

0

Suponha que o histórico seja assim:

Start-Date: 2016-09-20  15:49:21
Commandline: apt-get install kchmviewer
Install: libkde3support4:amd64 (4.14.2-5+deb8u1, automatic), libresid-builder0c2a:amd64 (2.1.1-14, automatic), ntrack-module-libnl-0:amd64 (016-1.3, automatic), libmpeg2-4:amd64 (0.5.1-7, automatic), libwinpr-thread0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkrosscore4:amd64 (4.14.2-5+deb8u1, automatic), libgpgme++2:amd64 (4.14.2-2+b1, automatic), oxygen-icon-theme:amd64 (4.14.0-1, automatic), libktexteditor4:amd64 (4.14.2-5+deb8u1, automatic), kdelibs5-data:amd64 (4.14.2-5+deb8u1, automatic), libchm1:amd64 (0.40a-3+b1, automatic), kchmviewer:amd64 (6.0-1), libcrystalhd3:amd64 (0.0~git20110715.fdd2f19-11, automatic), libdc1394-22:amd64 (2.2.3-1, automatic), libkdeui5:amd64 (4.14.2-5+deb8u1, automatic), libkdeclarative5:amd64 (4.14.2-5+deb8u1, automatic), libfam0:amd64 (2.7.0-17.1, automatic), libthreadweaver4:amd64 (4.14.2-5+deb8u1, automatic), libfreerdp-client1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-utils0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libqt4-sql-mysql:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libfreerdp-core1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), kde-runtime:amd64 (4.14.2-2, automatic), libchromaprint0:amd64 (1.2-1, automatic), libwinpr-synch0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkparts4:amd64 (4.14.2-5+deb8u1, automatic), nepomuk-core-data:amd64 (4.14.0-1, automatic), libqt4-sql:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libexiv2-13:amd64 (0.24-4.1, automatic), libqca2:amd64 (2.0.3-6, automatic), libntrack0:amd64 (016-1.3, automatic), upower:amd64 (0.99.1-3.2, automatic), kde-runtime-data:amd64 (4.14.2-2, automatic), libphonon4:amd64 (4.8.0-4, automatic), libwinpr-pool0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkemoticons4:amd64 (4.14.2-5+deb8u1, automatic), vlc-plugin-notify:amd64 (2.2.4-1~deb8u1, automatic), libnepomukquery4a:amd64 (4.14.2-5+deb8u1, automatic), libkmediaplayer4:amd64 (4.14.2-5+deb8u1, automatic), libwinpr-handle0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-crt0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libvlccore8:amd64 (2.2.4-1~deb8u1, automatic), libqt4-qt3support:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libdvbpsi9:amd64 (1.2.0-1, automatic), libfreerdp-cache1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-interlocked0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), katepart:amd64 (4.14.2-2, automatic), libproxy-tools:amd64 (0.4.11-4+b2, automatic), vlc-nox:amd64 (2.2.4-1~deb8u1, automatic), libkdnssd4:amd64 (4.14.2-5+deb8u1, automatic), soprano-daemon:amd64 (2.9.4+dfsg-1.1, automatic), libupnp6:amd64 (1.6.19+git20141001-1, automatic), phonon:amd64 (4.8.0-4, automatic), libsoprano4:amd64 (2.9.4+dfsg-1.1, automatic), libdbusmenu-qt2:amd64 (0.9.2-1, automatic), libkatepartinterfaces4:amd64 (4.14.2-2, automatic), vlc-plugin-samba:amd64 (2.2.4-1~deb8u1, automatic), libusageenvironment1:amd64 (2014.01.13-1, automatic), kdelibs5-plugins:amd64 (4.14.2-5+deb8u1, automatic), libqt4-script:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libebml4:amd64 (1.3.0-2+deb8u1, automatic), libxcb-xv0:amd64 (1.10-3+b1, automatic), libkjsapi4:amd64 (4.14.2-5+deb8u1, automatic), libcddb2:amd64 (1.3.2-5, automatic), libbasicusageenvironment0:amd64 (2014.01.13-1, automatic), libkactivities6:amd64 (4.13.3-1, automatic), libfreerdp-codec1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-input0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libgroupsock1:amd64 (2014.01.13-1, automatic), libiso9660-8:amd64 (0.83-4.2, automatic), libfreerdp-gdi1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-heap0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libwinpr-rpc0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), vlc-data:amd64 (2.2.4-1~deb8u1, automatic), libwinpr-library0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libknewstuff3-4:amd64 (4.14.2-5+deb8u1, automatic), libnepomukutils4:amd64 (4.14.2-5+deb8u1, automatic), libfreerdp-locale1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libfreerdp-primitives1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), kdoctools:amd64 (4.14.2-5+deb8u1, automatic), libgles2-mesa:amd64 (10.3.2-1+deb8u1, automatic), libkxmlrpcclient4:amd64 (4.14.2-2+b1, automatic), libkpty4:amd64 (4.14.2-5+deb8u1, automatic), libkjsembed4:amd64 (4.14.2-5+deb8u1, automatic), libwinpr-registry0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libqt4-designer:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libsolid4:amd64 (4.14.2-5+deb8u1, automatic), libkhtml5:amd64 (4.14.2-5+deb8u1, automatic), libssh-gcrypt-4:amd64 (0.6.3-4+deb8u2, automatic), libntrack-qt4-1:amd64 (016-1.3, automatic), libtwolame0:amd64 (0.3.13-1.1, automatic), libkfile4:amd64 (4.14.2-5+deb8u1, automatic), libwinpr-sspi0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), phonon-backend-vlc:amd64 (0.8.0-2, automatic), libzvbi0:amd64 (0.2.35-3, automatic), mysql-common:amd64 (5.5.52-0+deb8u1, automatic), libgles1-mesa:amd64 (10.3.2-1+deb8u1, automatic), libattica0.4:amd64 (0.4.2-1, automatic), libkdesu5:amd64 (4.14.2-5+deb8u1, automatic), libmysqlclient18:amd64 (5.5.52-0+deb8u1, automatic), libdlrestrictions1:amd64 (0.15.15, automatic), libstreams0:amd64 (0.7.8-1.2+b2, automatic), libknotifyconfig4:amd64 (4.14.2-5+deb8u1, automatic), libfreerdp-rail1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libxcb-composite0:amd64 (1.10-3+b1, automatic), libfreerdp-common1.1.0:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkdecore5:amd64 (4.14.2-5+deb8u1, automatic), kdelibs-bin:amd64 (4.14.2-5+deb8u1, automatic), libfreerdp-crypto1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkactivities-bin:amd64 (4.13.3-1, automatic), libva-x11-1:amd64 (1.4.1-1, automatic), plasma-scriptengine-javascript:amd64 (4.14.2-2, automatic), libnepomukcore4:amd64 (4.14.0-1+b2, automatic), libshine3:amd64 (3.1.0-2.1, automatic), libnepomuk4:amd64 (4.14.2-5+deb8u1, automatic), libwinpr-path0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libzvbi-common:amd64 (0.2.35-3, automatic), libwinpr-dsparse0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), vlc:amd64 (2.2.4-1~deb8u1, automatic), libstreamanalyzer0:amd64 (0.7.8-1.2+b2, automatic), libvlc5:amd64 (2.2.4-1~deb8u1, automatic), libmodplug1:amd64 (0.8.8.4-4.1+b1, automatic), docbook-xsl:amd64 (1.78.1+dfsg-1, automatic), libmatroska6:amd64 (1.4.1-2+deb8u1, automatic), libkntlm4:amd64 (4.14.2-5+deb8u1, automatic), libkdewebkit5:amd64 (4.14.2-5+deb8u1, automatic), liblivemedia23:amd64 (2014.01.13-1, automatic), libvcdinfo0:amd64 (0.7.24+dfsg-0.2, automatic), libiodbc2:amd64 (3.52.9-2, automatic), libwinpr-sysinfo0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libkcmutils4:amd64 (4.14.2-5+deb8u1, automatic), libpolkit-qt-1-1:amd64 (0.103.0-1, automatic), libsidplay2:amd64 (2.1.1-14, automatic), libwinpr-environment0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libva-drm1:amd64 (1.4.1-1, automatic), libkactivities-models1:amd64 (4.13.3-1, automatic), libnl-route-3-200:amd64 (3.2.24-2, automatic), libkate1:amd64 (0.4.1-4, automatic), libkio5:amd64 (4.14.2-5+deb8u1, automatic), libxml2-utils:amd64 (2.9.1+dfsg1-5+deb8u3, automatic), kate-data:amd64 (4.14.2-2, automatic), libfreerdp-utils1.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libvncclient0:amd64 (0.9.9+dfsg2-6.1+deb8u1, automatic), vlc-plugin-pulse:amd64 (2.2.4-1~deb8u1, automatic), libplasma3:amd64 (4.14.2-5+deb8u1, automatic), libupower-glib3:amd64 (0.99.1-3.2, automatic), libwinpr-file0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libqt4-declarative:amd64 (4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1, automatic), libwinpr-crypto0.1:amd64 (1.1.0~git20140921.1.440916e+dfsg1-4, automatic), libmpcdec6:amd64 (0.1~r459-4.1, automatic)
End-Date: 2016-09-20  15:50:34

Existem muitos pacotes listados, mas os nomes dos pacotes não são libkde3support4:amd64 (4.14.2-5+deb8u1, automatic) , por exemplo, em vez disso, é libkde3support4 . Então, como posso remover facilmente todos esses pacotes em um único comando?

Estou usando o lxde e o debian.

Usar apt-get remove kchmviewer && apt-get autoremove apenas remove dois pacotes:

Start-Date: 2016-09-20  15:51:15
Commandline: apt-get remove kchmviewer
Remove: kchmviewer:amd64 (6.0-1)
End-Date: 2016-09-20  15:51:18

Start-Date: 2016-09-20  15:51:32
Commandline: apt-get autoremove
Remove: libchm1:amd64 (0.40a-3+b1)
End-Date: 2016-09-20  15:51:33
    
por buzhidao 20.09.2016 / 09:13

1 resposta

2

Em teoria, você deve ser capaz de "desfazer" esta instalação removendo kchmviewer e todos os pacotes instalados automaticamente:

apt-get remove kchmviewer && apt-get autoremove

mas preste atenção aos pacotes removidos pelo segundo comando. A remoção automática pode não produzir os resultados desejados: por padrão, se um pacote instalado automaticamente for recomendado por qualquer outro pacote instalado, esse comando não o removerá. (Veja Por que o 'apt-get autoremove' não funcionou corretamente? para detalhes.)

Se você quiser processar o log, você pode usar este comando sed para transformar a linha "Install:" em uma lista de pacotes que você pode usar com apt-get remove (junto com 'apt-get remove kchmviewer) :

sed 's/([^)]*)//g;s/Install: //;s/ ,//g'

Levando o seu log em um arquivo chamado log (com apenas as linhas dadas na sua pergunta):

apt-get remove kchmviewer $(grep Install: log | sed 's/([^)]*)//g;s/Install: //;s/ ,//g')
    
por 20.09.2016 / 09:27