emerge -epv world | grep USE | cut -d '"' -f 2 | sed 's/ /\n/g' | sort | uniq | sed '/[(,)]/d' > use && grep ^- use | sed s/^-// | sed ':a;N;$!ba;s/\n/ /g' > notuse && sed -i /^-/d use && sed -i ':a;N;$!ba;s/\n/ /g' use

For Gentoo users : helping with USE / emerge

This command puts all the USE variables actually used by the packages you emerged to the file "use", and those which are unused but available to the file "notuse"