I am looking for a Unix command to print the files with its size. I used this but it didn’t work.
find . -size +10000k -print.
I want to print the size of the file along with the filename/directory.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If your version of
findwon’t accept the+notation (which acts rather likexargsdoes), then you might use (GNUfindandxargs, sofindprobably supports+anyway):or you might replace the
+with\;(and live with the relative inefficiency of this), or you might live with problems caused by spaces in names and use the portable:The
-don thelscommands ensures that if a directory is ever found (unlikely, but…), then the directory information will be printed, not the files in the directory. And, if you’re looking for files more than 1 MB (as a now-deleted comment suggested), you need to adjust the+10000kto1000kor maybe+1024k, or+2048(for 512-byte blocks, the default unit for-size). This will list the size and then the file name. You could avoid the need for-dby adding-type fto thefindcommand, of course.