Backup all your packages : pkg_info | awk '{print $1}' | while read P; do pkg_create -b $P; done Or with a little white space added ; pkg_info | awk '{print $1}' | while read P do pkg_create -b $P done