--------------------------------------------------------------------------------------------------------------------
備份目前電腦上的套件列表及 keys、家目錄
- mkdir /media/usb/backup_all_settings
- dpkg --get-selections > /media/usb/backup_all_settings/Package.list
- sudo cp /etc/apt/sources.list /media/usb/backup_all_settings/sources.list
- sudo cp -r /etc/apt/sources.list.d/ /media/usb/backup_all_settings/sources.list
- sudo apt-key exportall > /media/usb/backup_all_settings/Repo.keys
- sudo chown -R `whoami` /media/usb/backup_all_settings
- rsync -r --progress /home/`whoami` /media/usb/backup_user_home
至新電腦上還原及匯入套件、keys
- rsync --progress /media/usb/backup_user_home /home/`whoami`
- sudo apt-key add /media/usb/backup_all_settings/Repo.keys
- sudo cp /media/usb/backup_all_settings/sources.list /etc/apt/sources.list
- sudo apt-get update
- sudo apt-get install dselect
- sudo dpkg --set-selections < /media/usb/backup_all_settings/Package.list
- sudo apt-get dselect-upgrade -y
※紅色的部分代表的是隨身碟、外接硬碟或網路磁碟的路徑