加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

如何在整个系统(Linux)中搜索特定字符串?

发布时间:2020-12-13 17:03:46 所属栏目:Linux 来源:网络整理
导读:我需要找到这个字符串: 7z a -p 我试过了: grep -iR“7z a -p”/ 但它似乎在一段时间后挂起,有很多: grep: /sys/class/vc/vcs5/power/autosuspend_delay_ms: Input/output errorgrep: warning: /sys/class/vc/vcsa5/subsystem: recursive directory loopg
我需要找到这个字符串:
7z a -p

我试过了:

grep -iR“7z a -p”/

但它似乎在一段时间后挂起,有很多:

grep: /sys/class/vc/vcs5/power/autosuspend_delay_ms: Input/output error
grep: warning: /sys/class/vc/vcsa5/subsystem: recursive directory loop
grep: /sys/class/vc/vcsa5/power/autosuspend_delay_ms: Input/output error
grep: warning: /sys/class/vc/vcs6/subsystem: recursive directory loop

编辑 – 然而,这似乎只是看静态文本文件.另外,运行时区域,内存和进程呢?即整个系统?例如对于mysql:

ps aux | grep "mysql -u user -p"

显示:

38164  4292 pts/0    S+   13:16   0:00 mysql -uodbcuser -px xxxxxxxx

有趣的是ps aux确实用xxxxx隐藏了密码.我可以尝试使用7zip,但速度非常快,它必须在运行ps aux命令的同时运行才能“捕获它”.

解决方法

您应该从命令中排除/ sys /,/ proc /和/ dev /之类的目录:
grep -iR --exclude-dir='/sys' --exclude-dir='/proc' --exclude-dir='/dev' "7z a -p" /

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读