Time Machine从命令行进度


22

Time Machine”控制面板提供有关正在进行的备份的信息。例如

在此处输入图片说明

有没有办法从命令行获取信息?

Answers:


38

在备份运行时,可以通过以下方式获取详细信息

tmutil status

应该返回如下内容:

Backup session status:
{
    BackupPhase = Copying;
    ClientID = "com.apple.backupd";
    DateOfStateChange = "2014-12-18 14:14:21 +0000";
    DestinationID = "B4AF88-5AD5-49BE-B254-650B44E20499";
    DestinationMountPoint = "/Volumes/TimeMachine";
    Percent = "0.852581430477103";
    Progress =     {
        TimeRemaining = 0;
        "_raw_totalBytes" = 38596759;
        bytes = 36563200;
        files = 480;
        totalBytes = 42456434;
        totalFiles = 480;
    };
    Running = 1;
    Stopping = 0;
    "_raw_Percent" = "0.9473127005301144";
}

如果您只关心百分比,请尝试以下操作(看起来很丑,只有在要显示百分比的情况下才起作用):

tmutil status | awk '/_raw_Percent/ {print $3}' | grep -o '[0-9].[0-9]\+' | awk '{print $1*100}'

2
我在手册页中找不到此内容。您在哪里收集了该动词tmutil
jsejcksn

4
@jsejcksn说实话,我不记得我在哪里找到了statustmutil help status现在运行返回了*** status is a private verb. ***;为什么会这样,尤其是如果两年前是这种情况,我不知道:D
Asmus

2
数据的格式是什么tmutil?它不是JSON。是某种C对象转储吗?
LS

4
@LS,其格式设置为NeXTSTEP样式的属性列表
Asmus,

2

要仅获取百分比值:

tmutil status | awk -F'"' '/_raw_Percent/ {print $4*100}'
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.