Linux命令备忘

端口转发

# socat TCP-LISTEN:80,fork,reuseaddr TCP:XXX:80
# 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 cold reset

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