AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 993580
Accepted
Kalle Richter
Kalle Richter
Asked: 2018-01-09 06:45:48 +0800 CST2018-01-09 06:45:48 +0800 CST 2018-01-09 06:45:48 +0800 CST

Ubuntu +/- 1000% 的所有软件包中有多少个文件?

  • 772

我正在开发一个后继者,auto-apt它索引包使用的包信息apt并跟踪这些包中包含的文件的 I/O 请求作为程序包装器并自动安装它们。

所以我想知道Ubuntu大概有多少个包(10个就够了),这样我就可以对算法复杂度做一些估计。

原始代码似乎几十年未维护,并且在最后一个知道的地址下无法联系到作者(我写给他〜一年前,但他没有回复)。该程序似乎已在 17.10 被踢出 Ubuntu。此外,代码完全没有注释和测试(请不要那样做!),我需要猜测树状数据结构的目的是什么(可能是一个编程挑战)以及我是否可以只需将其替换为快速的第三方键值实现即可。

apt
  • 2 2 个回答
  • 271 Views

2 个回答

  • Voted
  1. fkraiem
    2018-01-09T08:18:52+08:002018-01-09T08:18:52+08:00

    在我的 17.10 系统上,我apt install在 1,360 个软件包apt list --installed | wc -l( 每个包平均大约有 133 个文件/目录。

    17.10 ( ) 中有 58,108 个包apt list | grep -c artful,因此假设我安装的包具有代表性,这会产生大约 7,749,038 个文件和目录。

    • 2
  2. Best Answer
    muru
    2018-01-10T01:53:52+08:002018-01-10T01:53:52+08:00

    该apt-file命令可用于查找提供给定文件的包。您需要运行apt-file update以便它可以下载文件列表,并且:

    $ apt-file update
    apt-file is now using the user's cache directory.
    If you want to switch back to the system-wide cache directory,
     run 'apt-file purge'
    Downloading complete file http://jp.archive.ubuntu.com/ubuntu/dists/xenial/Contents-amd64.gz
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      9 31.7M    9 2927k    0     0   282k      0  0:01:54  0:00:10  0:01:44  481k
    

    Contents-amd64.gz压缩后的 31 MB 文件也是如此。在 Vim 中打开它,我看到它有 5400831 行,在这个标题中大约有 30 行:

    This file maps each file available in the Ubuntu
    system to the package from which it originates.  It includes packages
    from the DIST distribution for the ARCH architecture.
    
    You can use this list to determine which package contains a specific
    file, or whether or not a specific file is available.  The list is
    updated weekly, each architecture on a different day.
    
    When a file is contained in more than one package, all packages are
    listed.  When a directory is contained in more than one package, only
    the first is listed.
    
    The best way to search quickly for a file is with the Unix `grep'
    utility, as in `grep <regular expression> CONTENTS':
    
     $ grep nose Contents
     etc/nosendfile                                          net/sendfile
     usr/X11R6/bin/noseguy                                   x11/xscreensaver
     usr/X11R6/man/man1/noseguy.1x.gz                        x11/xscreensaver
     usr/doc/examples/ucbmpeg/mpeg_encode/nosearch.param     graphics/ucbmpeg
     usr/lib/cfengine/bin/noseyparker                        admin/cfengine
    
    This list contains files in all packages, even though not all of the
    packages are installed on an actual system at once.  If you want to
    find out which packages on an installed Debian system provide a
    particular file, you can use `dpkg --search <filename>':
    
     $ dpkg --search /usr/bin/dselect
     dpkg: /usr/bin/dselect
    
    
    FILE                                                    LOCATION
    

    所以,我们有:

    540 万个文件,给或拿几个。

    • 2

相关问题

  • 如何编写 shell 脚本来安装应用程序列表?

  • 如何查看存档中可用的软件包的所有版本?

  • 是否可以说出我安装的哪些软件包不在原版安装中?

  • 如何删除 PPA?

  • 使用 apt-get upgrade 时如何强制安装内核更新?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve