我需要找到 Qt 插件目录,我花了一个小时寻找一种方法来查找包含 / 的目录名称。有大量的“qt”,如果“qt/plugins”错误,我需要一种不同的格式,所以我需要一个包含 / 的目录名称的通用搜索解决方案。
例如,我的计算机上存在 bin/yelp(我用它来测试),但我用 Google 找到的所有命令语法都无法找到它。
通常情况下,我只会弄清楚这样的事情,但我却花了一个多小时在这上面。
答案1
你能使用find
命令 - 使用-path
谓词代替通常的谓词-name
(它永远无法匹配包含路径分隔符的模式/
)。例如:
find / -path '*/qt/plugins' 2>/dev/null
领先*/
是必要的,因为-path
与所有的小路。
您也可以使用find / -regex '.*/qt/plugins' 2>/dev/null
(再次匹配整个路径,代替.*
shell glob 的通配符*
)但是正则表达式对于这种简单的模式没有任何优势。
答案2
locate
似乎是这里最有用的命令:
$ locate bin/yelp
/usr/bin/yelp
和
$ locate qt| grep plugins
/usr/lib/x86_64-linux-gnu/qt5/plugins
/usr/lib/x86_64-linux-gnu/qt5/plugins/bearer
/usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic
/usr/lib/x86_64-linux-gnu/qt5/plugins/iconengines
/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms
/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes
/usr/lib/x86_64-linux-gnu/qt5/plugins/styles
/usr/lib/x86_64-linux-gnu/qt5/plugins/xcbglintegrations
/usr/lib/x86_64-linux-gnu/qt5/plugins/bearer/libqconnmanbearer.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/bearer/libqgenericbearer.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/bearer/libqnmbearer.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations/libqeglfs-emu-integration.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations/libqeglfs-kms-egldevice-integration.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations/libqeglfs-kms-integration.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/egldeviceintegrations/libqeglfs-x11-integration.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqevdevkeyboardplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqevdevmouseplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqevdevtabletplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqevdevtouchplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqlibinputplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/generic/libqtuiotouchplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/iconengines/libqsvgicon.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqgif.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqico.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqjpeg.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/imageformats/libqsvg.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libcomposeplatforminputcontextplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforminputcontexts/libibusplatforminputcontextplugin.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqeglfs.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqlinuxfb.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimal.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqminimalegl.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqoffscreen.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqvnc.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqt5ct.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/styles/libqt5ct-style.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/xcbglintegrations/libqxcb-egl-integration.so
/usr/lib/x86_64-linux-gnu/qt5/plugins/xcbglintegrations/libqxcb-glx-integration.so
或者如果你只希望它以插件结束:
$ locate qt| grep 'plugins$'
/usr/lib/x86_64-linux-gnu/qt5/plugins
locate
有一个问题:它的结果基于它维护的数据库,并且该数据库不是实时的,但它是时不时构建的。updatedb
更新它。