Linux Shell Script


Find

-- Find corrupted zip file
find . -name "*.zip" -exec unzip -t "{}" \;  > rrrr.txt
find . -name "*.zip" -exec echo "{}" \;
{} means current file

-- Find file and limit the result
find 10587727/ -name "*.pdf" | head -2T

-- Find empty directory
find . -empty | sort

-- Find file lower than certain size:
find . -type f -size -200k -iname "*.pdf" -printf '%s %p\n'| sort -n | head -100`

Text Searching

cat zip_test.txt | grep pdf-archive.zip | sort | uniq