MacOS里有个『时间机器』,用于定时备份以及恢复数据和程序,平时都是在首选项(设置)里面找到后使用图形化界面,不过还是希望能在命令行下使用,方便我们在脚本中使用。
MacOS11 BigSur以上,稍有不同,请看 https://blog.terrynow.com/2021/11/15/macos-11-big-sur-and-up-timemachine-terminal-usage-and-clean-old-backups/
命令行介绍如下(包括列出、删除等命令)
# tmutil listbackups 命令可以显示 Time Machine 中的所有备份: $ tmutil listbackups /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-07-11-120422 /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-08-02-231305 /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-10-07-024559 /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2021-04-30-015300 /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2021-08-28-070716 /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2021-09-12-171704 # tmutil delete 命令则可以删除 Time Machine 中的指定备份: $ sudo tmutil delete -p /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-07-11-120422 Deleting: /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-07-11-120422 Deleted (427.2M): /Volumes/Time Machine Backups/Backups.backupdb/Terry iMac/2020-07-11-120422 $ tmutil latestbackup # 列出最新的备份
文章评论