sudo tmutil addexclusion
The part stands for the path to a file or folder. For example, if I want to exclude my Downloads folder from Time Machine backups, I would run the following:
sudo tmutil addexclusion ~/Downloads
The tmutil addexclusion command has an interesting property: it's sticky. When you use this command, the item you exclude remains in the Time Machine exclusion list even if you move it, which is not the case when you exclude items from the Time Machine preference pane. If you use the above command with the -p flag, then it will not be sticky, and will be the same as an exclusion you add from the Time Machine preference pane.
Manage remote backups
If you're managing a remote Mac, such as a server, you may want to change Time Machine settings for that computer. You can start by finding where Time Machine backups are stored. Run this command:
You'll see something like this in Terminal:
Name : TM Backup
Kind : Local
Mount Point : /Volumes/TM Backup
ID : B9DAT9A6-0C37-4C39-A2AE-10A3403C97F9
To change the destination, you can use two commands. First, remove the current destination like this:
In place of , type in the text string returned by the destinationinfo command. Then run this command to set up a new destination disk:
tmutil setdestination volume_name
Replace volume_name with the name of the disk or volume you want to use. You can add multiple destinations as well, since Time Machine can rotate its backups on several disks or volumes. See man tmutil for more on setting up multiple backup destinations. (You can now do this without the command line too, see "How to create redundant Time Machine backups.")
Get Time Machine stats
Time Machine saves a lot of backups: one per hour for the past 24 hours; one a day for the past week; and one a week before that. You can get a list of all the backups on your Time Machine disk with this command:
This will show the full path of each backup.
If you're curious about how much has changed in your Time Machine backups, there's a command that will let you find out how much of each backup is new. Run this command to see the delta between each of the Time Machine backups on your backup disk or volume:
tmutil calculatedrift backup_folder
Replace backup_folder with the path of the folder containing your backups. This is not the Backups.backupdb folder at the top level of your Time Machine volume, but rather the next folder down; this is generally labeled with your Mac's name.
For example, when I ran this command on my backups, I saw data like this:
Sign up for CIO Asia eNewsletters.