clean_Mac

利用 du 和sort 找出大文件、目录

Posted by kunnan on April 24, 2018

前言

  • 利用 du 和sort 进行排查大文件目录
devzkndeMacBook-Pro:Library devzkn$  du -sh * |sort -h

177M  Safari
587M  Logs
857M  Application Support
1.0G  Autosave Information
1.0G  Mail
2.6G  Caches
3.4G  Containers
3.6G  Android
 69G  Developer

正文

删除文件脚本

分析过程

  • 在系统根目录下执行du
153G  Users
 27G  Applications
 10G  private
6.4G  usr
  • /Users/devzkn/Library/Developer/Xcode
 /Users/devzkn/Library/Developer/Xcode

 39M	Products
126M	DocumentationCache
191M	UserData
414M	iOS Device Logs
823M	Archives
3.0G	DerivedData
 62G	iOS DeviceSupport ---大可直接删除

  • /Users/devzkn/Library/Developer/CoreSimulator
/Users/devzkn/Library/Developer/CoreSimulator/Devices  --- xcrun simctl list devices、

<!-- xcrun simctl help delete -->
So I can either delete the individual device(s):

xcrun simctl delete D24C18BC-268C-4F0B-9CD8-8EFFDE6619E3

or I can bulk delete all of the unavailable ones with:

xcrun simctl delete unavailable


xcrun simctl help

  • garageband
<!-- https://www.tekrevue.com/tip/delete-garageband/ -->

macintosh hd/applications/garageband.app (1.16gb)
macintosh hd/library/application support/garageband (995mb)
macintosh hd/library/application support/logic (880mb)
macintosh hd/library/audio/apple loops (up to 10gb)*

  • /Users/devzkn/Library/Containers
/Users/devzkn/Library/Containers/com.tencent.qq/Data/Library/Caches/Images

/Users/devzkn/Library/Containers/com.tencent.xinWeChat/Data/Library/Application Support/com.tencent.xinWeChat/2.0b4.0.9/168382edfbf20fc8e6340f8590a006c0/M

  • /Users/devzkn/Pictures/照片图库.photoslibrary
  • tail获取iOS模拟器日志
日志文件的路径:/Users/$UserName/Library/Logs/CoreSimulator/$simulator_hash/system.log
simulator_hash:模拟器的identifier,可在Xcode中查看

或者使用:xcrun simctl list devices

  • 删除QuickLook缓存文件

 sudo rm -rf /private/var/folders/

<!-- 这个文件夹内的文件是你在真机测试时安装程序的详情 -->
  /private/var/folders/8s/t119mw8d4lsdztx8h9q8113m0000gn/c/com.apple.DeveloperTools/All/Xcode/EmbeddedAppDeltas

see also

/Users/devzkn/bin/knpost clean_Mac 利用 du 和sort 找出大文件、目录 -t Terminal
#原来""的参数,需要自己加上""

转载请注明: > clean_Mac