彻底清理idea配置脚本
- 直接贴在终端运行
- 脚本不会直接删除文件,只会生成删除命令,用户可以二次确认
PS: 本脚本在IDEA 2020的版本试运行成功,如果有遗漏请在底下留言
function printDeleteIdeaExec(){
user_home=~
# 在 ~/Library/Logs/JetBrains 找idea的配置
log_dir=$user_home/Library/Logs/JetBrains
ls -1 $log_dir | awk '{ print "rm -rf \""pwd"/"$0"\""}' pwd=$log_dir | grep IntelliJIdea
# 在 ~/Library/Preferences 找idea的配置
pre_dir=$user_home/Library/Preferences
ls -1 $pre_dir | awk '{ print "rm -f \""pwd"/"$0"\""}' pwd=$pre_dir | grep jetbrains
# 在 ~/Library/Application Support/JetBrains 找idea的配置
sup_dir="$user_home/Library/Application Support/JetBrains"
ls -1 "$sup_dir" | awk '{ print "rm -rf \""pwd"/"$0"\""}' pwd="$sup_dir" | grep IntelliJIdea
# 在 ~/Library/Caches/JetBrains 找idea的配置
cache_dir="$user_home/Library/Caches/JetBrains"
ls -1 "$cache_dir" | awk '{ print "rm -rf \""pwd"/"$0"\""}' pwd="$cache_dir" | grep IntelliJIdea
# 删除idea的工作空间
idea_dir="$user_home/.idea"
echo "rm -rf $idea_dir"
}
printDeleteIdeaExec
输出如下:
rm -rf "/Users/link/Library/Logs/JetBrains/IntelliJIdea2020.2"
rm -f "/Users/link/Library/Preferences/com.jetbrains.intellij.plist"
rm -f "/Users/link/Library/Preferences/jetbrains.idea.d7ab3053.plist"
rm -f "/Users/link/Library/Preferences/jetbrains.jetprofile.asset.plist"
rm -rf "/Users/link/Library/Application Support/JetBrains/IntelliJIdea2020.2"
rm -rf "/Users/link/Library/Caches/JetBrains/IntelliJIdea2020.2"
rm -rf "/Users/link/.idea"