我试图找到属于特定用户的文件,该文件还包含特定的文本字符串.例如,我想找到一个属于root用户的文件,并包含"hello there"文本.
我知道我可以使用grep搜索文件中的文本,例如:
grep -irl "hello there" /directory1
Run Code Online (Sandbox Code Playgroud)
而且,我知道我可以搜索具有特定扩展名的用户拥有的文件:
find -user root -name "*.txt"
Run Code Online (Sandbox Code Playgroud)
有没有办法可以将这两个命令结合起来?