| Line 3: |
Line 3: |
| | ===find files modified in the last 24h=== | | ===find files modified in the last 24h=== |
| | <nowiki>find <path> -mtime -1 -ls</nowiki> | | <nowiki>find <path> -mtime -1 -ls</nowiki> |
| | + | |
| | + | === Last 3 accessed files === |
| | + | <syntaxhighlight lang="bash"> |
| | + | find . -type f -exec stat -c '%X %n' {} \; | sort -nr | awk 'NR==1,NR==3 {print $2}' |
| | + | </syntaxhighlight> |
| | + | |
| | + | === Last 3 modified files === |
| | + | <syntaxhighlight lang="bash"> |
| | + | find . -type f -exec stat -c '%Y %n' {} \; | sort -nr | awk 'NR==1,NR==3 {print $2}' |
| | + | </syntaxhighlight> |
| | + | |
| | + | * <code>find . -type f -exec stat -c '%X %n' *</code>: prints the last access' time followed by the file's path for each file in the current directory hierarchy; |
| | + | * <code>find . -type f -exec stat -c '%Y %n' *</code>: prints the last modification's time followed by the file's path for each file in the current directory hierarchy; |
| | + | * <code>sort -nr</code>: sorts in an inverse numerical order; |
| | + | * <code>awk 'NR==1,NR==3 {print $2}'</code>: prints the second field of the first, second and third line. |
| | + | |
| | + | You can change the number of files to be shown by changing 3 to the desired number of files in <code>awk 'NR==1,NR==3 {print $2}'</code>. |
| | + | |
| | ===find case insensitive=== | | ===find case insensitive=== |
| | find . -iname "fileName.txt" | | find . -iname "fileName.txt" |