15.1. Remove Unnecessary Files

The system is almost finished. It can be made smaller by removing files that are not necessary.

Create a copy of the file system in case changes need to be made to it later:

install -dv ${CLFS}-final
cp -arv ${CLFS}/* ${CLFS}-final/

Remove files that aren't needed:

rm -rfv ${CLFS}-final/cross-tools
rm -rfv ${CLFS}-final/usr/src/*
rm -rfv ${CLFS}-final/usr/include
rm -rfv ${CLFS}-final/usr/man
rm -rfv ${CLFS}-final/usr/share/man
rm -rfv ${CLFS}-final/build

Remove the static libaries:

FILES="$(ls ${CLFS}-final/lib/*.a ${CLFS}-final/usr/lib/*.a)"
for file in $FILES; do
 rm -fv $file
done