Command Cheat Sheet
ubuntu20.04 替换源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse \ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse" > /etc/apt/sources.list
apt update
ubuntu22.04 替换源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse \ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse\ndeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse" > /etc/apt/sources.list
apt update
debian11 替换源
mv /etc/apt/sources.list /etc/apt/sources.list.bak
echo -e "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free \ndeb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free \ndeb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free \ndeb http://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free" > /etc/apt/sources.list
apt update
nvida-smi 查看详细gpu占用
nvidia-smi dmon -s pucvme
k8s
删除一直在terminating的namespace
来源 StackOverflow
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}')
do
kubectl get ns $ns -ojson | jq '.spec.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -
done
for ns in $(kubectl get ns --field-selector status.phase=Terminating -o jsonpath='{.items[*].metadata.name}')
do
kubectl get ns $ns -ojson | jq '.metadata.finalizers = []' | kubectl replace --raw "/api/v1/namespaces/$ns/finalize" -f -
done
删除namespace下所有的资源
kubectl delete all --all -n ${namespace}