Find file in Linux then report the size of file searched [duplicate]

We can use find command to find the file and du -sh to find out its size.

We will execute du -sh on found files. So final command would be

find ~ -name "core.txt" -exec du -sh {} \;
or
find ~ -name "core.txt" | xargs du -sh

In 2nd command xargs will not handle spaces in file name. So We can tell exact delimiter to xargs to handle spaces in file name.

find ~ -name "core.txt" | xargs -d '\n' du -sh

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)