如果我们在 sudo `apt-get autoremove` 末尾添加一个点,会发生什么情况

如果我们在 sudo `apt-get autoremove` 末尾添加一个点,会发生什么情况

sudo apt-get autoremove .

输出:

WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
apt libapt-pkg4.12 (due to apt) libc6 (due to apt) libgcc1 (due to apt)
libstdc++6 (due to apt) ubuntu-keyring (due to apt) gnupg (due to apt)
base-files base-passwd libdebconfclient0 (due to base-passwd) bash
debianutils (due to bash) dash (due to bash) libtinfo5 (due to bash)
bsdutils coreutils libacl1 (due to coreutils) libattr1 (due to coreutils)
libselinux1 (due to coreutils) dpkg (due to dash) sensible-utils (due to
debianutils) diffutils libbz2-1.0 (due to dpkg) liblzma5 (due to dpkg)
zlib1g (due to dpkg) tar (due to dpkg) e2fsprogs e2fslibs (due to e2fsprogs)
libblkid1 (due to e2fsprogs) libcomerr2 (due to e2fsprogs) libss2 (due to
e2fsprogs) libuuid1 (due to e2fsprogs) util-linux (due to e2fsprogs)
findutils grep install-info (due to grep) libpcre3 (due to grep) gzip
hostname libc-bin libcap2 (due to libc-bin) login libpam0g (due to login)
libpam-runtime (due to login) libpam-modules (due to login) mount libmount1
(due to mount) ncurses-base ncurses-bin perl-base sed lsb-base (due to
util-linux) tzdata (due to util-linux) debconf (due to util-linux) sysv-rc
(due to util-linux) libncurses5 (due to util-linux) libslang2 (due to
util-linux)
0 upgraded, 0 newly installed, 2913 to remove and 0 not upgraded.
After this operation, 8,775 MB disk space will be freed.
You are about to do something potentially harmful.
To continue type in the phrase 'Yes, do as I say!'
?] 

那个点起什么作用?

答案1

哇,首先不要这样做。命令:

apt-get autoremove a_packet_name

将删除指定的包及其所有依赖项。但您可以使用正则表达式作为包名称。因此,的包名称.将匹配系统上安装的每个包。确实非常有害!

更多详细信息来自man apt-get

如果没有包与给定的表达式匹配,并且表达式包含“.”、“?”或“*”之一,则假定它是 POSIX 正则表达式,并将其应用于数据库中的所有包名称。然后安装(或删除)任何匹配项。请注意,匹配是通过子字符串完成的,因此“lo.*”匹配“how-lo”和“lowest”。如果不希望出现这种情况,请使用“^”或“$”字符固定正则表达式,或创建更具体的正则表达式。

相关内容