apt-get 不是命令_使用APT而不是apt-get简化命令行程序包管理

apt-get 不是命令

apt-get 不是命令

apt-instead-apt-get-main

APT, the Advanced Package Tool from the Debian project, is for managing packages by using a lot of separate tools to accomplish various tasks. In the past, users needed to know multiple command structures like apt-get, apt-cache, apt-config, and many more to utilize the full feature-set of APT.

APT是Debian项目的高级软件包工具,用于通过使用许多单独的工具来完成各种任务来管理软件包。 过去,用户需要了解apt-get,apt-cache,apt-config等多种命令结构,才能利用APT的全部功能集。

APT was created originally to solve a lot of package management problems like putting an end to the dependency hell that so many people experienced in the early days of Linux-based operating systems. Unfortunately, APT suffers from a different kind of hell, something I call “Dispersed Documentation Hell” (DDH). The documentation related to APT is scattered in various different tools and in some cases, such as the main apt command, practically impossible to find.

创建APT最初是为了解决许多程序包管理问题,例如结束依赖地狱 ,这是许多人在基于Linux的操作系统早期所经历的。 不幸的是,APT遭受了另一种痛苦,我称之为“ 分散文档地狱 ”(DDH)。 与APT相关的文档分散在各种不同的工具中,在某些情况下,例如main apt命令,实际上几乎找不到。

For over a decade, practically all tutorials and guides for installing and removing packages on a Debian/Ubuntu based system have been suggesting apt-get to users. In the past, that was the correct suggestion because “apt” as a command hadn’t existed at the time but due to the Dispersed Documentation Hell a lot of people aren’t aware that now it does exists.

十多年来,几乎所有在基于Debian / Ubuntu的系统上安装和删除软件包的教程和指南都向用户建议使用apt-get。 在过去,这是正确的建议,因为“ apt”作为命令尚不存在,但是由于分散文档地狱,很多人不知道现在它确实存在。

If you wanted to install a package almost all guides will suggest:

如果您想安装软件包,几乎所有指南都会建议:

sudo apt-get install package

sudo apt-get install package

but now instead you can simplify that with

但是现在您可以使用

sudo apt install package

sudo apt install package

Some may argue that “apt” isn’t much different than “apt-get” and that is true but I think the hyphen in the command is what creates a bottleneck for many users due to its awkwardness. Using apt instead will save time and save the amount of keystrokes required to accomplish the same task.

有人可能会说“ apt”与“ apt-get”并没有什么不同,这是事实,但我认为命令中的连字符是由于其笨拙而造成许多用户瓶颈的原因。 相反,使用apt可以节省时间并节省完成同一任务所需的击键次数。

分散文档地狱(DDH) (Dispersed Documentation Hell (DDH))

apt-instead-apt-get-documentation-hell

The fundamental problem with the documentation regarding APT is that depending on where you look and how you look, you may or may not find anything at all. If you were to search Google, or DuckDuckGo, for “apt documentation” you’d find one of three types of results:

有关APT的文档的根本问题在于,取决于您所处的位置和外观,您可能会或可能根本找不到任何东西。 如果您要搜索Google或DuckDuckGo的“ apt文档”,则会发现以下三种结果之一:

  1. apt-get related documentation

    apt-get相关文档
  2. Basic overview information regarding APT

    有关APT的基本概述信息
  3. Completely unrelated information

    完全不相关的信息

If you were to throw “linux”, “ubuntu”, or even “debian” into the search query the types of results you’ll receive won’t change. The DDH is so severe that you’ll find documentation from Debian.org marked as Obsolete Documentation before you’ll find anything useful related to the “apt” command, if you ever find it at all.

如果将“ linux”,“ ubuntu”或什至“ debian”放入搜索查询中,您将收到的结果类型将保持不变。 DDH非常严重,以至于您从Debian.org上找到标记为“ 过时的文档”的文档,然后再找到与“ apt”命令相关的任何有用信息(如果有的话)。

手册页 (Man Pages)

Man Pages are documentation pages that can be used locally on your system or via online directories. Local entries may or may not be up to date depending on the version of your distro. For example, Ubuntu 15.10 has the latest man page but 14.04 does not by default. However, if you keep your 14.04 version of Ubuntu up to date with service packs then you should have the updated man page. You can check to see if you have the latest version of the man page with the command below.

手册页是可以在系统上本地使用或通过在线目录使用的文档页面。 本地条目可能是最新的,也可能不是最新的,具体取决于发行版的版本。 例如,Ubuntu 15.10具有最新的手册页,但14.04默认情况下没有。 但是,如果您使用Service Pack使您的Ubuntu 14.04版本保持最新,那么您应该拥有更新的手册页。 您可以使用以下命令检查是否具有最新版本的手册页。

man apt

man apt

On the other hand, if you were to search for the man page online then you will almost always find the old overview man page. If you were to keep digging, though, you may uncover the Ubuntu 15.10 man page which is up to date or instead you may uncover the online 14.04 man page which is out of date.

另一方面,如果要在线搜索手册页,则几乎总是可以找到旧的概述手册页 。 但是,如果要继续挖掘,您可能会发现最新的Ubuntu 15.10手册页 ,或者可能会发现最新的在线14.04手册页

使用APT简化命令行 (Simplify the Command-Line with APT)

The list below contains the most useful options available via the apt command and what old commands they simplify.

下面的列表包含可通过apt命令使用的最有用的选项,以及它们可以简化的旧命令。

  • apt install package(s)

    apt安装软件包

    • replaces apt-get install package

      替换apt-get安装包

    • replaces cd /Downloads && sudo dpkg -i application.deb && sudo apt-get -f install

      替换cd / Downloads && sudo dpkg -i application.deb && sudo apt-get -f安装

    apt install package(s)

    apt安装软件包

  • apt remove package(s)

    apt删除软件包

    • replaces apt-get remove package

      替换apt-get remove软件包

    apt remove package(s)

    apt删除软件包

  • apt search query

    apt搜索查询

    • replaces apt-cache search query

      替换apt-cache搜索查询

    apt search query

    apt搜索查询

  • apt show package(s)

    apt show软件包

    • replaces apt-cache show package(s)

      替换apt-cache show软件包

    apt show package(s)

    apt show软件包

  • apt update

    apt更新

    • replaces apt-get update

      替换apt-get更新

    apt update

    apt更新

  • apt upgrade

    适当升级

    • replaces apt-get upgrade

      取代apt-get升级

    apt upgrade

    适当升级

  • apt list –installed

    apt列表–已安装

    • replaces dpkg –get-selections | grep -v deinstall

      替换dpkg –get-selections | grep -v卸载

    • replaces dpkg -l

      代替dpkg -l

    apt list –installed

    apt列表–已安装

  • apt list –upgradable (sudo not required)

    apt列表–可升级 (不需要sudo)

    • replaces apt-get -u upgrade –assume-no” (sudo required)

      替换apt-get -u upgrade –assume-no”(需要sudo)

    apt list –upgradable (sudo not required)

    apt列表–可升级 (不需要sudo)

  • apt edit-sources

    apt编辑源

    • replaces echo ‘new line of text’ | sudo tee -a /etc/apt/sources.list

      替换echo'文本的新行'| sudo tee -a /etc/apt/sources.list

    • replaces sudo nano /etc/apt/sources.list

      替换sudo nano /etc/apt/sources.list

    apt edit-sources

    apt编辑源

Edit 2016-04-01: as of Ubuntu 16.04 the following options have been added to the Debian/Ubuntu implementation of the apt command.

编辑2016-04-01:从Ubuntu 16.04开始,以下选项已添加到apt命令的Debian / Ubuntu实现中。

  • apt autoremove

    apt自动删除

    • replaces apt-get autoremove

      替换apt-get autoremove

    apt autoremove

    apt自动删除

  • apt purge package(s)

    apt吹扫包装

    • replaces apt-get purge package(s)

      替换apt-get purge软件包

    apt purge package(s)

    apt吹扫包装

Linux Mint增强了简便性 (Linux Mint is Enhancing Simplicity)

apt-instead-apt-get-linux-mint

Most of the recent operating systems based on Debian or Ubuntu have the up to date version of APT that allows for some tasks to be simplified but the Linux Mint team decided that APT should be simplified quite a few years ago. Linux Mint created a python script (started in 2009) to make APT as useful and as simple as possible. I hope that Debian sees the benefit of expanding the functionality of apt so that in the future everyone can benefit from the simplified approach that Mint is taking. The apt command can be so much better than it is right now and hopefully Debian sees this as well and brings apt to its full potential.

最近基于Debian或Ubuntu的大多数操作系统都具有最新版本的APT,该版本允许简化某些任务,但Linux Mint团队决定在几年前简化APT。 Linux Mint创建了一个python脚本 (始于2009年 ),以使APT尽可能有用且尽可能简单。 我希望Debian看到扩展apt功能的好处,以便将来每个人都可以从Mint所采用的简化方法中受益。 apt命令可能比现在的命令好得多,希望Debian也能看到这一点,并发挥其全部潜力。

Linux Mint decided to make an interesting choice in their script by removing the need to use sudo. For example, if you run “apt install package” it will automatically apply sudo to the front of it during processing so the user doesn’t need to remember if something needs sudo or not, the script will apply it or not accordingly.

Linux Mint决定通过取消使用sudo的方式在脚本中做出有趣的选择。 例如,如果您运行“ apt install package”,它将在处理过程中将sudo自动应用于其前端,因此用户无需记住是否需要sudo,脚本将相应地对其进行应用。

The list below contains the most useful additional options available via the Linux Mint apt command and what old commands they simplify. Note: the following list only applies to Linux Mint users at the moment.

下面的列表包含可通过Linux Mint apt命令获得的最有用的附加选项,以及它们可以简化哪些旧命令。 注意:以下列表目前仅适用于Linux Mint用户。

  • apt autoclean

    apt autoclean

    • replaces apt-get autoclean

      替代apt-get autoclean

    apt autoclean

    apt autoclean

  • apt autoremove

    apt自动删除

    • replaces apt-get autoremove

      替换apt-get autoremove

    apt autoremove

    apt自动删除

  • apt purge package(s)

    apt吹扫包装

    • replaces apt-get remove –purge package(s)

      替换apt-get remove –purge软件包

    apt purge package(s)

    apt吹扫包装

  • apt depends package(s)

    apt取决于软件包

    • replaces apt-cache depends package(s)

      替换apt-cache依赖包

    apt depends package(s)

    apt取决于软件包

  • apt rdepends package(s)

    apt rdepends软件包

    • replaces apt-rdepends package(s)

      替换apt-rdepends软件包

    apt rdepends package(s)

    apt rdepends软件包

  • apt policy package(s)

    合适的政策包

    • replaces apt-cache policy package(s)

      替换apt-cache策略包

    apt policy package(s)

    合适的政策包

  • apt held

    举行

    • replaces dpkg –get-selections | grep hold

      替换dpkg –get-selections | grep hold

    apt held

    举行

  • apt hold package

    合适的包装

    • replaces echo package hold | sudo dpkg –set-selections

      替换echo包保留| sudo dpkg –设置选择

    apt hold package

    合适的包装

  • apt unhold package

    合适的解包

    • replaces echo package install | sudo dpkg –set-selections

      替换echo软件包安装| sudo dpkg –设置选择

    apt unhold package

    合适的解包

  • apt download package (downloads the deb file of a package)

    apt下载软件包 ( 下载软件包的deb文件)

    • replaces LC_ALL=C apt-cache depends package |grep -v “Conflicts:\|Replaces:”|awk ‘{print $NF}’|sed -e ‘s/[<>]//g’|xargs aptitude download -r

      替换LC_ALL = C apt-cache取决于软件包| grep -v“冲突:\ |替换:” | awk'{print $ NF}'| sed -e's / [<>] // g'| xargs aptitude下载- [R

    apt download package (downloads the deb file of a package)

    apt下载软件包 ( 下载软件包的deb文件)

APT:事半功倍 (APT: Do More with Much Less)

The apt command has simplified a lot of tasks with command-line package management on the Linux (Debian-based) desktop and with Linux Mint taking the initiative to improve it further, hopefully it will help the community transition to the new method. The only command that I noticed Linux Mint’s apt script missing thus far is “apt add-repository” to replace the awkward add-apt-repository command, so I wrote a patch to add this feature to the script. I’m pleased to inform you that they have accepted my patch so this feature will be available in a future release of Linux Mint.

apt命令通过Linux(基于Debian)桌面上的命令行程序包管理以及Linux Mint主动对其进行了进一步改进,简化了许多任务,希望它将帮助社区过渡到新方法。 我注意到到目前为止, Linux Mint的apt脚本缺少的唯一命令是“ apt add-repository”,以替换笨拙的add-apt-repository命令,因此我编写了一个补丁程序将此功能添加到脚本中。 我很高兴地通知您,他们已经接受了我的补丁程序,因此该功能将在以后Linux Mint版本中可用。

翻译自: https://www.howtogeek.com/234583/simplify-command-line-package-management-with-apt-instead-of-apt-get/

apt-get 不是命令

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值