strings 是 binutils 包里的工具,在 Ubuntu 上“找不到”通常只有几种常见原因。下面按出现频率从高到低给你排查。
Ubuntu 默认不一定装 strings,它属于 binutils。
which strings
如果没输出,说明没装或不在 PATH 中。
sudo apt update
sudo apt install binutils
安装后再试:
strings --version
echo $PATH
find /usr -name strings 2>/dev/null
常见位置:
/usr/bin/strings
如果找到了但 which strings 没有,说明 PATH 不完整。
临时解决:
export PATH=$PATH:/usr/bin
如果你在搞嵌入式 / 交叉编译:
strings
和
arm-linux-gnueabihf-strings
是不同的命令。
✅ 正确用法示例:
arm-linux-gnueabihf-strings your_binary
type strings
如果不是 strings is /usr/bin/strings,说明被 alias 或函数覆盖了。
strings test.bin
strings /bin/ls
如果你是想在 ELF / 二进制 / core dump 里找字符串,这是对的。
很多 Docker 基础镜像 没有 binutils:
docker run ubuntu:22.04 strings
会直接报:
command not found
✅ 解决:
apt update && apt install -y binutils
你可以直接跑这个:
which strings || echo "未安装"
dpkg -l | grep binutils
Ubuntu 上
strings找不到,99% 是没装binutils,装一下就好了。
如果你愿意,可以把你看到的完整报错信息贴出来,我可以更精确地判断是哪一种情况。