实用工具集

来自刘东华的维基
跳转至: 导航搜索
  • nc, 两服务器之间传送文件,简单便捷
# install on CentOS
yum install nmap-ncat
 
# 接收文件
nc -l [port] > /path/to/save/file
 
# 发送文件
cat /file/to/send | nc [host] [port]
  • pssh, 批量在远程机器上执行命令并取回结果,挺方便的,可以节省不少时间. github
# Sample: run command
pssh -h hosts.txt "nohup du -sh /* > /tmp/result.txt 2>&1 &"
 
# Sample: get results
pslurp -h hosts.txt -L ./results /tmp/result.txt result.txt
  • sendEmail, perl实现的基于smtp发送邮件的脚本。sendEmail
# Simple Email
sendEmail -f me@gmail.com        \
          -t friend@yahoo.com    \
          -s smtp.gmail.com:587  \
          -xu me@gmail.com       \
          -xp MY-PASSWORD        \
          -u "Test email"        \
          -m "Hi buddy, this is a test email."