Difference between revisions of "Linux command: find"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) |
Rafahsolis (talk | contribs) Tag: visualeditor |
||
| Line 1: | Line 1: | ||
| − | === find files === | + | ===find files=== |
<nowiki>find <path> -name <filename></nowiki> | <nowiki>find <path> -name <filename></nowiki> | ||
| − | === 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> | ||
| − | === find case | + | ===find case insensitive=== |
find . -iname "fileName.txt" | find . -iname "fileName.txt" | ||
| − | === find video files === | + | ===find video files=== |
find . -type f -exec file -N -i -- {} + | grep video | find . -type f -exec file -N -i -- {} + | grep video | ||
or if you only want the filenames ... | or if you only want the filenames ... | ||
find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p' | find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p' | ||
| − | === Exclude extension === | + | ===Exclude extension=== |
find Vídeos/popcorntime/ -type f -not -name "*.torrent" -not -name "*.jpg" -not -name "*.srt" -not -name "*.txt" -exec mv "{}" /media/rafa/HM_030/video/ \; | find Vídeos/popcorntime/ -type f -not -name "*.torrent" -not -name "*.jpg" -not -name "*.srt" -not -name "*.txt" -exec mv "{}" /media/rafa/HM_030/video/ \; | ||
| − | === Large Files === | + | ===Large Files=== |
find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }' | find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }' | ||
Revision as of 12:18, 30 April 2019
find files
find <path> -name <filename>
find files modified in the last 24h
find <path> -mtime -1 -ls
find case insensitive
find . -iname "fileName.txt"
find video files
find . -type f -exec file -N -i -- {} + | grep video
or if you only want the filenames ...
find . -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p'
Exclude extension
find Vídeos/popcorntime/ -type f -not -name "*.torrent" -not -name "*.jpg" -not -name "*.srt" -not -name "*.txt" -exec mv "{}" /media/rafa/HM_030/video/ \;
Large Files
find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'