linux学习实操计划0101-linux卸载软件

本系列内容全部给予Ubuntu操作系统。

系统版本:#32~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 18 10:40:13 UTC 2

1 以卸载网易云为例

  1. 使用以下命令来查找已安装的网易云音乐应用程序的包名:

    dpkg -l | grep netease-cloud-music

    或者,如果您使用的是基于Red Hat的Linux发行版(如Fedora),可以使用以下命令:

    rpm -qa | grep netease-cloud-music
    

    这将列出与网易云音乐相关的软件包。

这一步骤解决的问题是,如何准确找到安装包的名字。因此使用这种搜索方式,先确认安装包的名字,可以模糊搜索。

linux学习实操计划0101-linux卸载软件_第1张图片

2. 使用以下命令卸载网易云音乐。请将下面的命令中的package-name替换为上一步中找到的包名:

sudo dpkg -r package-name   # 对于基于Debian的系统,如Ubuntu

或者

sudo rpm -e package-name   # 对于基于Red Hat的系统,如Fedora

即对于Ubuntu来说,卸载用 dpkg -r 命令。

 linux学习实操计划0101-linux卸载软件_第2张图片

2 注意事项: 

  1. 输入您的管理员密码(sudo密码)以确认卸载。

  2. 卸载完成后,您可以使用以下命令删除可能残留的配置文件:

    rm -r ~/.config/netease-cloud-music
    

    这将删除网易云音乐的配置文件。

3 dpkg功能延伸

输入 dpkg --help 可获得安装和卸载软件包的有关帮助 [*];
使用 apt 或是 aptitude 就能在友好的界面下管理软件包;
输入 dpkg -Dhelp 可看到 dpkg 除错标志的值的列表;
输入 dpkg --force-help 可获得所有强制操作选项的列表;
输入 dpkg-deb --help 可获得有关操作 *.deb 文件的帮助;
 

 -i|--install       <.deb 文件名> ... | -R|--recursive <目录> ...
  --unpack           <.deb 文件名> ... | -R|--recursive <目录> ...
  -A|--record-avail  <.deb 文件名> ... | -R|--recursive <目录> ...
  --configure        <软件包名>    ... | -a|--pending
  --triggers-only    <软件包名>    ... | -a|--pending
  -r|--remove        <软件包名>    ... | -a|--pending
  -P|--purge         <软件包名>    ... | -a|--pending
  -V|--verify <软件包名> ...       检查包的完整性。
  --get-selections [<表达式> ...]  把已选中的软件包列表打印到标准输出。
  --set-selections                 从标准输入里读出要选择的软件。
  --clear-selections               取消选中所有非必需的软件包。
  --update-avail <软件包文件>      替换现有可安装的软件包信息。
  --merge-avail  <软件包文件>      把文件中的信息合并到系统中。
  --clear-avail                    清除现有的软件包信息。
  --forget-old-unavail             忘却已被卸载的不可安装的软件包。
  -s|--status      <软件包名> ...  显示指定软件包的详细状态。
  -p|--print-avail <软件包名> ...  显示可供安装的软件版本。
  -L|--listfiles   <软件包名> ...  列出属于指定软件包的文件。
  -l|--list  [<表达式> ...]        简明地列出软件包的状态。
  -S|--search <表达式> ...         搜索含有指定文件的软件包。
  -C|--audit [<表达式> ...]        检查是否有软件包残损。
  --yet-to-unpack                  列出标记为待解压的软件包。
  --predep-package                 列出待解压的预依赖。
  --add-architecture    <体系结构> 添加 <体系结构> 到体系结构列表。
  --remove-architecture <体系结构> 从体系结构列表中移除 <体系结构>。
  --print-architecture             显示 dpkg 体系结构。
  --print-foreign-architectures    显示已启用的异质体系结构。
  --assert-<特性>                  对指定特性启用断言支持。
  --validate-<属性> <字符串>       验证一个 <属性>的 <字符串>。
  --compare-versions <关系> 比较版本号 - 见下。
  --force-help                     显示本强制选项的帮助信息。
  -Dh|--debug=help                 显示有关出错调试的帮助信息。

  -?, --help                       显示本帮助信息。
      --version                    显示版本信息。

可验证的属性:pkgname, archname, trigname, version.

调用 dpkg 并带参数 -b, --build, -c, --contents, -e, --control, -I, --info,
  -f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, --fsys-tarfile
是针对归档文件的。 (输入 dpkg-deb --help 获取帮助)

Options:
  --admindir=     Use instead of /var/lib/dpkg.
  --root=         Install on a different root directory.
  --instdir=      Change installation dir without changing admin dir.
  --pre-invoke=     Set a pre-invoke hook.
  --post-invoke=    Set a post-invoke hook.
  --path-exclude=   Do not install paths which match a shell pattern.
  --path-include=   Re-include a pattern after a previous exclusion.
  -O|--selected-only         Skip packages not selected for install/upgrade.
  -E|--skip-same-version     Skip packages whose same version is installed.
  -G|--refuse-downgrade      Skip packages with earlier version than installed.
  -B|--auto-deconfigure      Install even if it would break some other package.
  --[no-]triggers            Skip or force consequential trigger processing.
  --verify-format=   Verify output format (supported: 'rpm').
  --no-pager                 Disables the use of any pager.
  --no-debsig                Do not try to verify package signatures.
  --no-act|--dry-run|--simulate
                             Just say what we would do - don't do it.
  -D|--debug=         Enable debugging (see -Dhelp or --debug=help).
  --status-fd            Send status change updates to file descriptor .
  --status-logger=  Send status change updates to 's stdin.
  --log=           Log status changes and actions to .
  --ignore-depends=[,...]
                             Ignore dependencies involving .
  --force-[,...]      Override problems (see --force-help).
  --no-force-[,...]   Stop when problems encountered.
  --refuse-[,...]     Ditto.
  --abort-after          Abort after encountering errors.
  --robot                    Use machine-readable output on some commands.

可供--compare-versions 使用的比较运算符有:
 lt le eq ne ge gt        (如果版本号为空,那么就认为它先于任意版本号);
 lt-nl le-nl ge-nl gt-nl  (如果版本号为空,那么就认为它后于任意版本号);
 < << <= = >= >> >        (仅仅是为了与主控文件的语法兼容)。

'apt' 和 'aptitude' 提供了更为便利的软件包管理。
 

你可能感兴趣的:(Linux相关应用,linux,学习,运维)