Search for a Package With apt-file

本文介绍了如何在Ubuntu系统中使用dpkg和apt-file命令来查找特定文件或命令所属的软件包。首先通过dpkg -S 命令定位已安装文件的归属,接着介绍如何安装并使用apt-file搜索未安装的包,最终找到所需软件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Recently I needed ogg123 on an Ubuntu server to convert some media.Naturally, I wanted to use aptitude to install it, but I didn't know whatpackage it was in. Now, you can always google of course, but you can also usesystem commands to find the package you need.

Already have the file? Use dpkg

If you already have the file, and just want to know which package it belongsto, you can use dpkg like this:

$ dpkg -S $(which ogg123)

(replace ogg123 with the command you are looking for)

Don't have it yet? Use apt-file

I didn't have the package yet, so dpkg doesn't know about it either.

In this case you can install a nifty little program called apt-file, whichfetch & build a database of all apt packages and their contents, so you caneasily find what you need.

Installing apt-file

Ok, let's install apt-file first.

$ aptitude install apt-file

apt-file works just like apt, so we need to update it's database before wecan use it.

$ apt-file update

Search

Now we're ready to search for our package:

$ apt-file search ogg123

Which in my case returned:

irssi-scripts: /usr/share/irssi/scripts/ogg123.pl
python-pyvorbis: /usr/share/doc/python-pyvorbis/examples/ogg123.py
vorbis-tools: /usr/bin/ogg123
vorbis-tools: /usr/share/doc/vorbis-tools/examples/ogg123rc-example
vorbis-tools: /usr/share/man/man1/ogg123.1.gz

Very well, vorbis-tools it is!

$ aptitude install vorbis-tools

You've just got to love the apt.


http://kvz.io/blog/2008/11/08/search-for-a-package-with-aptfile/

什么情况apollo_ros@lxf-pc:~/apollo_ros_ws$ apt-get update && apt-get install -y build-essential libc6-dev Reading package lists... Done E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied) apollo_ros@lxf-pc:~/apollo_ros_ws$ echo | gcc -v -E - 2>&1 | grep "include" Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.2' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-9QDOt0/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/include-fixed" ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include # 1 "/usr/include/stdc-predef.h" 1 3 4 apollo_ros@lxf-pc:~/apollo_ros_ws$
最新发布
03-14
引用和中提到了找不到"moveit_core"和"moveit_commander"的包配置文件的错误。这通常是由于没有正确安装相关依赖包或者没有正确设置相应的环境变量所致。为了解决这个问题,你可以按照以下步骤进行操作: 1. 确保你已经正确安装了"moveit_core"和"moveit_commander"的相关依赖包。你可以使用以下命令进行安装: sudo apt-get install ros-melodic-moveit-core sudo apt-get install ros-melodic-moveit-commander 2. 如果你已经安装了相关依赖包但仍然出现错误,你可以尝试设置相应的环境变量。你可以在CMakeLists.txt文件中添加以下内容: set(ENV{moveit_core_DIR} /opt/ros/melodic/share/moveit_core/cmake) set(ENV{moveit_commander_DIR} /opt/ros/melodic/share/moveit_commander/cmake) 3. 确保你的工作空间已经重新编译,你可以使用以下命令进行编译: catkin_make 或者 catkin build 通过以上步骤,你应该可以解决"moveit_core"和"moveit_commander"包配置文件找不到的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [Could not find a package configuration file provided by “moveit_core“ with any ...](https://blog.youkuaiyun.com/m0_56451176/article/details/126368991)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Could not find a package configuration file provided by “moveit_commander](https://blog.youkuaiyun.com/ben_xiao_hai_123/article/details/122103534)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值