我正在尝试查找名称为
formClass.php
且包含字符串 checkCookie 的文件,并且我想按日期列出文件,显示日期、大小、所有者和组。这些文件位于我的主目录中。
我可以使用此功能,但它不显示日期、所有者等...
find /home -name formClass.php -exec grep -l "checkCookie" {} \;
我想我可以像这样将“trhg”添加到列表中,但它不起作用:
find /home -name formClass.php -exec grep -ltrhg "checkCookie" {} \;
谢谢
尝试
find /home -name formClass.php -print0 | xargs -0 grep -l --null checkCookie | xargs -0 ls -l
ls -lt `grep -lr --include=formClass.php "checkCookie" *`
查看
man ls
了解其他排序选项。
似乎有几种方法可以做到这一点。我发现了这个,它对我有用。
find /home -name formClass.php -exec grep -l "checkCookie" {} \; | xargs ls -ltrhg
谢谢您的其他建议。