Delete Apple Time Machine Backups

A brief example of how to use awk and xargs commands.

-

Sometimes you need to awk and xargs things. In this case deleting time machine backups is a slow and painful copy paste problem. awk the standard out and trim the date stamp off the output of tmutil listbackups then pass them into xargs command to tmutil delete the backups.

tmutil listbackups | awk '{print substr($4,9,16)}' | xargs sudo tmutil delete /Volumes/Time\ Machine\ Backups/Backups.backupdb/richard’s\ MacBook/
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-04-23-111144
Deleted (791.7M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-04-23-111144
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-05-03-004641
Deleted (1.8G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-05-03-004641
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-05-13-033055
Deleted (8.1G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-05-13-033055
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-01-085822
Deleted (2.5G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-01-085822
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-17-215950
Deleted (4.4G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-17-215950
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-22-185353
Deleted (224.7M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-22-185353
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-23-002613
Deleted (119.5M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-23-002613
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-24-002044
Deleted (613.5M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-24-002044
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-25-184024
Deleted (139.0M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-25-184024
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-26-001837
Deleted (157.2M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-26-001837
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-29-101306
Deleted (3.5G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-29-101306
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-30-002950
Deleted (203.8M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-06-30-002950
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-01-002851
Deleted (213.7M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-01-002851
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-03-195348
Deleted (232.0M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-03-195348
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-04-001846
Deleted (772.6M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-04-001846
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-09-191958
Deleted (345.5M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-09-191958
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-093546
Deleted (122.7M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-093546
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-101623
Deleted (84.4M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-101623
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-105217
Deleted (10.8M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-105217
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-112733
Deleted (13.7M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-112733
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-121340
Deleted (13.3M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-121340
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-131640
Deleted (14.6M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-131640
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-141524
Deleted (42.8M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-141524
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-151759
Deleted (102.6M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-151759
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-161846
Deleted (11.2M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-161846
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-172240
Deleted (13.8M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-172240
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-181411
Deleted (12.4M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-181411
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-191456
Deleted (20.5M): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-191456
Deleting: /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-202545
Deleted (315.4G): /Volumes/Time Machine Backups/Backups.backupdb/richard’s MacBook/2019-07-14-202545

Rich Minchuk

Technology Enthusiast and Wannabe Growth Hacker