Cleaning and deleting software packages under Ubuntu

1. Clean the downloaded software installation package ( /var/cache/apt/archives/)

sudo apt-get clean

2. Delete software packages that are useless to satisfy dependencies.

sudo apt-get autoclean

 The underlying package of apt is dpkg, and when dpkg installs the software package, it will *.debplace the file /var/cache/apt/archives/in; therefore, this command will delete the expired deb in this directory.

3. Completely uninstall a software

(1) Delete the software and its configuration files

sudo apt-get --purge remove <pkgname>

(2) Delete useless dependent packages

sudo apt-get autoremove <pkgname>

(3) Clean up the software packages with "rc" status in the dpkg list

sudo dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P

 4. Introduction to dpkg

Ubuntu is a Linux system based on Debian, and the Debian system software uses APT and dpkgis managed. dpkgIt is the abbreviation of "Debian Packager" and is a low-level software package management tool. The related apt-get tool can download and install deb packages online.

dpkg -i <.deb file name>              #安装软件包; 
dpkg -l                              #显示已安装软件包列表;
dpkg -l | grep <pkgname>             #查看是否安装某个软件
dpkg -r <pkgname>                    #删除软件包,不删除配置文件; 
dpkg -P <pkgname>                    #删除软件包的同时删除其配置文件; 
dpkg -L <pkgname>                    #显示于软件包关联的文件,可获得软件安装位置;  

Guess you like

Origin blog.csdn.net/weixin_44884561/article/details/128038402