darrh00
2022 年 7 月 2 日
清理 TM 的 bash 函数,把以下内容写到 ~/.profile
function tmc() {
before=$(df -hl /System/Volumes/Data |awk '{print $3}' |tail -n1)
count=0
for snapshot in $(tmutil listlocalsnapshots /System/Volumes/Data|awk -F. '{print $4}');do
let 'count++'
echo "delete snapshot $snapshot"
tmutil deletelocalsnapshots $snapshot;
done
after=$(df -hl /System/Volumes/Data |awk '{print $3}' |tail -n1)
if [[ $count -ne 0 ]]; then
echo "Total $count snapshot(s) deleted, Size change: $before ===> $after"
else
echo "No snapshot deleted"
fi
}
function tml() {
tmutil listlocalsnapshots /System/Volumes/Data|awk -F. '{print $4}'
}
source .profle 后执行 tmc