(我想我可以使用grep,無論如何....)嘗試遞歸列出在特定日期修改的文件,但是,我嘗試使用的命令列出按日期排序的所有內容,或者只列出目錄中的文件我進來了。有沒有辦法做到這一點?它是grep還是別的?unix幫助grep?
0
A
回答
1
您可以合併ls
和grep
以遞歸列出文件,然後搜索特定的日期。
# List files recursively with `-R` and grep for a date.
ls -lR | grep 'Nov 23'
find
可用於遞歸地查找符合您選擇的標準的文件。然後它可以顯示這些文件名,或將它們傳遞給另一個命令或任何數量的操作。
# Display all files modified yesterday.
find -mtime 0
# Display all files modified yesterday in `ls -l' format.
find -mtime 0 -ls
# Search all files modified yesterday for the string "foobar".
# "{}" is a placeholder for the file names and "+" tells find to
# pass all the files at once to a single invocation of grep.
find -mtime 0 -exec grep foobar {} +
3
參見find
,特別是謂詞-anewer
,-atime
,-mtime
,-newer
和-newerXY
。
0
五月像
find . -type f -exec ls -l \{\} \; | grep " Aug 26 2003"
讓你開始了嗎?
0
最容易使用的是zsh。節拍發現任何一天簡單和性能明智。
ls **/*(m5)
將遞歸列出5天前剛剛修改的文件。 ls **/*(mh-5)
將列出在過去5小時內修改的文件。您可以根據需要選擇月份,日期,小時,分鐘,秒。如果需要,您可以要求提供N天前訪問的文件,而不是修改時間。
當然,命令不一定是ls。你需要做的任何事情都會做。
相關問題
- 1. 幫助與unix焦油和grep循環
- 2. UNIX - 在grep命令需要幫助
- 3. Grep/RegExp幫助
- 4. UNIX - makefile幫助!
- 5. Grep使用幫助
- 6. 幫助grep在BBEdit
- 7. 幫助編譯在UNIX中
- 8. 需要幫助的Unix
- 9. UNIX加入命令幫助?
- 10. 幫助「查找」和「grep」命令
- 11. 幫助使用grep [[:阿爾法:]] * -O
- 12. Unix grep命令
- 13. UNIX grep命令
- 14. 高級grep unix
- 15. Unix grep查詢
- 16. UNIX grep命令(grep的-v grep的)
- 17. 需要grep幫助輸出另一個grep命令
- 18. Unix SALT如何幫助保護密碼?
- 19. 需要關於UNIX時代的幫助
- 20. UNIX的sed命令的幫助
- 21. Unix中的文件描述符幫助
- 22. 幫助UNIX時間到人類時間
- 23. 有關文件的Unix幫助
- 24. 從unix調用python的基本幫助
- 25. Unix C Shell腳本printf幫助
- 26. Grep multiple「and」expressions UNIX
- 27. 的Unix grep命令
- 28. 在unix中,與unix命令「history | grep keyword」
- 29. Unix bash切割和grep
- 30. UNIX命令:grep的-A
很酷。我不知道`ls`可以遞歸地工作! – dennycrane 2010-11-23 15:29:37