一、背景
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
這個結果表明這個文件安裝成功了。
