簡體   English   中英

Linux 查找文件和 grep 然后按日期列出

[英]Linux find files and grep then list by date

我正在嘗試查找名稱為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 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以獲取其他排序選項。

似乎有幾種方法可以做到這一點。 我發現了這個,它對我有用。 查找 /home -name formClass.php -exec grep -l "checkCookie" {} \; | xargs ls -ltrhg

謝謝你的其他建議。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM