$ apt-get clean
$ apt-get autoclean
#!/bin/bash ## CACHE_DIR="/var/cache/apt/archives" ## apt-get #CACHE_DIR="/var/cache/pacman/pkg" ## pacman' ## EXT="deb" #EXT="pkg.tar.gz" ## ArchLinux' ## , FILTER="sed s/_[0-9].*_//" #FILTER="sed s/-[0-9].*//" ## ArchLinux' function remove { echo -e "$1\t\t\t[removed]"; rm -f $1; } cd "$CACHE_DIR"; ## echo "Changed working dir on `pwd`"; pkgs=(`ls | grep $EXT`); ## hashs=(`ls | grep $EXT | $FILTER`); ## pkgsNum=${#pkgs[@]} ## echo "$pkgsNum files in cache now"; for (( i=0; i<$pkgsNum-1; i++ )); do #echo "cheking package ${pkgs[$i]}..."; for (( j=$i+1; j<${pkgsNum}; j++ )); ## hashes do if [ ${hashs[$i]} = ${hashs[$j]} ]; then ## if [ ${pkgs[$i]} -ot ${pkgs[$j]} ]; then ## remove ${pkgs[$i]}; break; else remove ${pkgs[$j]}; fi fi done done
$ yaourt -S repo-clean
Source: https://habr.com/ru/post/61547/
All Articles