command-line fuzzy finder
LinuxOpenWRT

如何在OpenWRT上使用fzf

fzf 是一个 交互式的 可以用于任何列表,文件,命令行历史,进程,主机名等的模糊搜索神器。它基于Go语言,没有其他依赖(并不是,依赖完整的find),速度非常快。

fzf command line show case.

fzf并未在OpenWRT的仓库中提供,但是我们可以通过git的方式进行安装:

git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install

国内用户可以使用gitee的镜像:

git clone --depth 1 https://gitee.com/mirrors/fzf.git ~/.fzf
~/.fzf/install

默认情况下,在OpenWRT上使用fzf时会提示:

Command failed: set -o pipefail; command find -L . -mindepth 1 \( -path '*/\.*' -o -fstype 'sysfs' -o -fstype 'devf..)

这是由于OpenWRT默认使用busybox作为Unix工具集,其提供的find工具为简化版本,对fstype参数无法完全支持,所以我们需要安装完全版的find命令:

opkg update
opkg install findutils findutils-find --force-reinstall

–force-reinstall参数的作用是如果之前有安装过findutils的话,强制进行重新安装。

安装完成之后,通过fzf命令即可进入fzf模式。有了fzf,查找OpenWRT软路由上的文件就变得更方便了。


为什么最近没更新OpenWRT相关的内容?因为路由器已经折腾到一个稳定的状态了呀。

Hi, I’m Yawata

这次不要再从零开始。 什么都想学一点,什么都想会一点。 区块链入门水平,前端入门水平。喜欢用Google, neovim, Windows。前重度游戏玩家,已游戏阳痿。

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注