实用命令集合

实用命令集合

不重启扫描硬盘

for dirname in `ls /sys/class/scsi_device/`; do echo 1 > /sys/class/scsi_device/$dirname/device/rescan ; done
for dirname in `ls /sys/class/scsi_host/`;do echo "- - -" > /sys/class/scsi_host/$dirname/scan; done

张亚博客:https://www.jianshu.com/p/0f52e56ff0f0

git设置代理

git config --global http.proxy http://172.18.80.222:41091
git config --global https.proxy http://172.18.80.222:41091
git config --global --unset http.proxy
git config --global --unset https.proxy

git记住密码

git config --global credential.helper store

快速生成证书

openssl genrsa -out tls.key 2048
openssl req -new -x509 -key tls.key -out tls.cert -days 360 -subj /CN=www.pingface.com

kubectl设置命令补全

$ yum install bash-completion -y
$ source /usr/share/bash-completion/bash_completion
$ source <(kubectl completion bash)
$ kubectl completion bash >/etc/bash_completion.d/kubectl

查看k8s集群相关信息

# 查看所有节点上已有的污点
$ kubectl describe nodes  | grep -oPz 'Taints.*?(.|\n)*?Unschedulable|Name:.*' | grep Unschedulable -v
# 查看所有节点上已有的标签
$ kubectl describe nodes  | grep -oPz 'Lab.*?(.|\n)*?Annotations|Name:.*' | grep Annotations -v

python pip下载使用国内源

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple

jdk环境变量

tar xf jdk-8u60-linux-x64.tar.gz -C /app/
ln -s /app/jdk1.8.0_60 /app/jdk
cat > /etc/profile << 'EOF'
export JAVA_HOME=/opt/jdk
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
EOF
source /etc/profile
java -version

JDK下载网址

https://adoptopenjdk.net/

Nginx的rpm包

http://nginx.org/packages/rhel/7/x86_64/RPMS/

npm安装

cd /opt/
wget https://nodejs.org/dist/v14.17.6/node-v14.17.6-linux-x64.tar.xz
tar xf node-v14.17.6-linux-x64.tar.xz -C /opt/
ln -s /opt/node-v14.17.6-linux-x64 /opt/node
echo 'export PATH=/opt/node/bin/:$PATH' >>/etc/profile
source /etc/profile
node -v
npm -v

node使用淘宝源

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm install
cnpm run start &