如何發(fā)現(xiàn)W: Duplicatesources.listentryhttp://security.ubuntu.com ...
有人指出:Use this to find duplicate lines;
grep -v ^# /etc/apt/sources.list | sort | uniq -c | sort
有人指出: cat /etc/apt/sources.list | perl -ne '$H{$_}++ or print' > /tmp/sources.list && sudo mv /tmp/sources.list /etc/apt/sources.list
The command does this:
cat reads the file and passes the content to perl which removes the duplicate lines. The result is then saved > in a temporary file which is then moved to replace the original /etc/apt/sources.list file.
搞清楚這個(gè)命令可以協(xié)助Linux入門了。