Monday, April 14, 2014

Find files

The commands below handle UTF-8 characters.


According to the size

To find files, the following command can be used. This command is going to list the names of files and the size of files matching a criterion (+100000k or larger than 100000k).

$ find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'



According to the file extension



$ grep . -r -i --include \*.doc

Here, it looks for files with the file extension .doc.


For Terminal to display UTF-8 characters, the correct font should be installed, e.g. fonts-arphic-ukai for displaying Chinese characters.



References

http://stackoverflow.com/questions/12516937/grep-but-only-certain-file-extensions

http://www.cyberciti.biz/faq/find-large-files-linux/

No comments: