Linux命令备忘

端口转发

# socat TCP-LISTEN:80,fork,reuseaddr TCP:XXX:80
# socat TCP-LISTEN:8630,fork,reuseaddr TCP:127.0.0.1:22
# ssh -o ProxyCommand="nc --proxy-type socks5 --proxy 10.X.X.X:1080 %h %p" root@10.X.X.X
# nc -c nc XXX 80 -l 80 -v -k

紧急救援

mount -o remount,rw /

即时HTTP Server

  • Python 2
python -m SimpleHTTPServer 8080
  • Python 3
python -m http.server 8080
python -m CGIHTTPServer 8080

下载Nexus

wget --user=userid --password=password 'https://nexusurl:8081/nexus/repository/<repository id>/<replace the grouf is . with />/<artifact id>/<version>/<file name>' -O ${WORKSPACE}/<new file name>

ipmitool

ipmitool -H ipaddress -I lanplus -U username -P password power status
ipmitool -H ipaddress -I lanplus -U username -P password power on
ipmitool -H ipaddress -I lanplus -U username -P password power off
ipmitool -H ipaddress -I lanplus -U username -P password bmc reset cold

pip

pip install XXX -i https://pypi.douban.com/simple --trusted-host=pypi.douban.com

以ISO形式打包网络配置文件

1. yum install genisoimage -y
2. mkisofs -r -o XXXX.iso /etc/sysconfig/network-scripts
3. 导出XXXX.iso,并在终端页面CD/DVD挂载XXXX.iso
4. mount /dev/sr0 /path/to/mount

为编译活动增加swap空间

dd if=/dev/zero of=swapfile bs=1G count=10
mkswap swapfile
swapon swapfile

Storcli操作

storcli64 /c0 show
storcli64 /c0 set jbod=on
storcli64 /c0 /v1 del
storcli64 /c0 /e8 /s2 set jbod

续签证书

openssl x509 -req -sha256 -days <> -in <>.csr -signkey <>.key -out <>.crt