sh 清除rubygem,yarn,composer,homebrew,docker和删除临时文件的缓存

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 清除rubygem,yarn,composer,homebrew,docker和删除临时文件的缓存相关的知识,希望对你有一定的参考价值。

###
# free_disk_space
#
# remove files from downloads folder
# clear cache for rubygem, yarn, composer, homebrew, docker
###

free_disk_space() {
    if command -v docker &> /dev/null; then
        echo "--> Clear Docker images cache" && \
        docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi

        echo -n "--> Would you like to prune docker system ? (y/N) "
        read response
        if [[ $response = "y" ]]; then
            docker system prune -f
        fi
    fi

    command -v brew &> /dev/null && \
    echo "--> Clear Homebrew cache" && \
    brew cleanup

    command -v yarn &> /dev/null && \
    echo "--> Clear Yarn cache" && \
    yarn cache clean &> /dev/null

    command -v composer &> /dev/null && \
    echo "--> Clear Composer cache" && \
    composer clear-cache &> /dev/null

    command -v gem &> /dev/null && \
    echo "--> Clear Rubygems old versions" && \
    gem cleanup 2 > /dev/null

    echo -n "--> Clear downloads directory ? (y/N) "
    read response
    if [[ $response = "y" ]]; then
        case $(uname -s) in
            "Darwin" ) rm -r $HOME/Downloads/*;;
            *) echo "System not supported unavailable";;
        esac
    fi

    if command -v ncdu &> /dev/null; then
        echo -n "--> Would you like to run ncdu? (y/N) "
        read response
        if [[ "$response" = "y" ]]; then
            echo -n "    Run ncdu from wich path? ($HOME) "
            read response
            response=${response:-$HOME}
            ls $response &> /dev/null && ncdu $response
        fi
    fi

    return;
}

以上是关于sh 清除rubygem,yarn,composer,homebrew,docker和删除临时文件的缓存的主要内容,如果未能解决你的问题,请参考以下文章

sh 为已安装的每个版本的ruby升级rubygems。

docker-compose 中的 Yarn 命令找不到 && 命令

Vagrant Docker Composer Yarn 国外资源下载慢或失败的问题

Yarn聚合日志, 过期清除配置不生效

sh spark-submit-wordcount-yarn.sh

1 ./sbin/start-yarn.sh时,报错there is no YARN_RESOURCEMANAGER_USER defined