LINUX 拥有遍历文件夹功能的 查找关键字 文件、文件夹
查找文件:
[ admin]# find . -type f -name "a.txt" ./Downloads/hadoop-2.10.0/a.txt
拥有遍历文件夹功能的 查找关键字 文件、文件夹:
[ admin]# vi a [ admin]# find /home/admin/ -type f | xargs grep "i like apple" Binary file /home/admin/.cache/tracker/meta.db matches Binary file /home/admin/.cache/tracker/meta.db-wal matches grep: /home/admin/.cache/yelp/WebKitCache/Version: No such file or directory grep: 14/salt: No such file or directory grep: /home/admin/Downloads/hadoop-2.10.0/share/hadoop/yarn/webapps/ui2/assets/images/datatables/Sorting: No such file or directory grep: icons.psd: No such file or directory /home/admin/a:i like apple (把包含i like apple 那一行取出, 如果是i like apple too, 这里显示的就是i like apple too) [ admin]# [ admin]# cat ai like applehahahaha
grep:查找指定目录/home/admin及其子目录(如果存在子目录的话)下所有文件中包含字符串"i like apple too"的文件,并打印出该字符串所在行的内容,使用的命令为:
[ admin]# grep -r "i like apple" /home/admin Binary file /home/admin/.cache/tracker/meta.db matches /home/admin/a:i like apple too
相关推荐
jimeshui 2020-11-13
ningningmingming 2020-08-14
andylanzhiyong 2020-06-16
咏月东南 2020-06-16
lanyou00 2020-06-06
secondid 2020-06-05
chenchuang 2020-05-29
kylinos 2020-03-07
onlykg 2020-05-06
farwang 2020-04-26
applex 2020-04-22
bluecarrot 2020-04-20
xushxbigbear微信 2020-02-19
jackadmi 2020-02-19
神龙 2020-02-15
Darklovy 2020-01-12
NeverAgain 2020-01-11