debian系在线安装软件apt-get命令族
一、背景
apt-get install/remove在线安装/卸载文件真是方便极了。
但是有时候安装/卸载文件不清楚文件在服务器上的实际命名,例如想安装sndfile。应该执行下面哪个命令呢?
1 apt-get install sndfile 2 apt-get install libsndfile
正确答案是都不对。如何知道正确的命名呢?
二、查询文件命名
apt-cache一个非常有用的命令出来了。
(类比RedHat系的yum search)
1. apt-cache search sndfile
查询的结果如下:
libsndfile1 - Library for reading/writing audio files libsndfile1-dbg - debugging symbols for libsndfile libsndfile1-dev - Development files for libsndfile; a library for reading/writing audio files alure-doc - AL Utilities REtooled (documentation) alure-utils - AL Utilities REtooled (utilities) ir.lv2 - LV2 IR reverb jack-capture - program for recording soundfiles with jack kluppe - loop-player and recorder designed for live use libalure-dev - AL Utilities REtooled (development files) libalure1 - AL Utilities REtooled (shared library) moc - ncurses based console audio player python-soundfile - Python audio module based on libsndfile and NumPy python3-soundfile - Python 3 audio module based on libsndfile qmmp - feature-rich audio player with support of many formats samplerate-programs - Sample programs that use libsamplerate silan - commandline tool to detect silence in audio-files sndfile-programs - Sample programs that use libsndfile sndfile-programs-dbg - debugging symbols for sndfile-programs sndfile-tools - Collection of programs for operating on sound files xmms2-plugin-sndfile - XMMS2 - sndfile decoder zita-resampler - resampler application written with libzita-resampler
这个查询的有点太模糊了,含有字母s,n,d,f,i,l,e(甚至部分字母)的结果都出来了。
来个更准确一点的查询吧。
2. apt-cache search sndfile|grep sndfile
查询的结果如下:
libsndfile1 - Library for reading/writing audio files libsndfile1-dbg - debugging symbols for libsndfile libsndfile1-dev - Development files for libsndfile; a library for reading/writing audio files python-soundfile - Python audio module based on libsndfile and NumPy python3-soundfile - Python 3 audio module based on libsndfile sndfile-programs - Sample programs that use libsndfile sndfile-programs-dbg - debugging symbols for sndfile-programs sndfile-tools - Collection of programs for operating on sound files xmms2-plugin-sndfile - XMMS2 - sndfile decoder
结果清爽多了。
3. 现在知道了,安装sndfile的正确命令是
apt-get install libsndfile1
二、查询文件详细信息
apt-cache show libsndfile1
查询的结果片段如下:
... Architecture: amd64 Source: libsndfile Version: 1.0.25-10 Depends: libc6 (>= 2.14), libflac8 (>= 1.3.0), libvorbisenc2 (>= 1.1.2) Filename: pool/main/libs/libsndfile/libsndfile1_1.0.25-10_amd64.deb Size: 137498 ...
版本,依赖关系,文件大小什么的都出来了。
三、查询已安装文件
dpkg -l |grep libsndfile1
查询结果如下:
ii libsndfile1:amd64 1.0.25-10ubuntu0.16.04.1 amd64 Library for reading/writing audio files
这个结果表明这个文件安装成功了。
上善若水,水利万物而不争。