Loading

整理日常运维所涉及的资料

由于一些软件下载困难或寻找麻烦,所以整理备用

SSH 连接工具:iterm2、xshell

Office365全家桶、Sublime TXT、Xmind(思维导图)Snipaste(截图)、Typora(书写markdown)

工具

名称 下载链接
Git https://git-scm.com/downloads
VMware (Windows) 链接:https://pan.baidu.com/s/1JGTiz1ktC5yQ6-PXaDhX1A
提取码:yhlv
VMware (macOS) 链接: https://pan.baidu.com/s/19VRdtt0dtNym3SvXuSVQ-w
提取码:pk1q
Microsoft Remote Desktop For Windows 链接: https://pan.baidu.com/s/1TT7Y9qilBVpWAkctBbsknw
密码: t502
Microsoft Remote Desktop For macOS 链接: https://pan.baidu.com/s/18XyIgqEnY61atyqDMPxVDw
密码: s9j9
Xshell 6 链接: https://pan.baidu.com/s/1HltVmDsP3n9iYhCXV56P-A
提取码:eyqm

Linux 环境

名称 链接
Linux Kernel Archives https://www.kernel.org/
CentOS 7 http://mirror.centos.org/centos/7/os/x86_64/Packages/
CentOS 8 http://mirror.centos.org/centos/8/BaseOS/x86_64/os/Packages/
gcc https://ftp.gnu.org/gnu/gcc/
zlib http://www.zlib.net/
make https://ftp.gnu.org/gnu/make/
openssl https://www.openssl.org/source/
wget https://ftp.gnu.org/gnu/wget/
tar https://ftp.gnu.org/gnu/tar/
which https://ftp.gnu.org/gnu/which/
NTP http://support.ntp.org/bin/view/Main/WebHome
Jenkins http://updates.jenkins-ci.org/download/war/
HTTP https://downloads.apache.org/httpd/
NGINX http://nginx.org/download/

Windows 环境

名称 链接
安全更新指南 https://portal.msrc.microsoft.com/zh-cn/security-guidance
https://www.catalog.update.microsoft.com/home.aspx
NET Framework https://dotnet.microsoft.com/download/dotnet-framework/net472
Windows10镜像 https://www.microsoft.com/zh-cn/software-download/windows10ISO
Azure PowerShell https://docs.microsoft.com/zh-cn/powershell/azure/get-started-azureps?view=azps-3.0.0

根据命令查找软件包名称

rpm -qf  $(which ps)
rpm -ivh file rpm ## 安装rpm包
rpm -e file.rpm  ## 卸载rpm包
rpm -qR tree  #R的意思就是requires就是依赖哪些软件包

查看链接状态

netstat -an | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

查看连接你服务器 top10 用户端的 IP 地址

netstat -nat | awk '{print $5}' | awk -F ':' '{print $1}' | sort | uniq -c | sort -rn | head -n 10

在远程机器上运行一段脚本。这条命令最大的好处就是不用把脚本拷到远程机器上。

ssh user@server bash < /data/scripts/script.sh

非交互式创建用户

useradd zhangsan && echo 123456|passwd --stdin zhangsan #新建用户

\cp /etc/sudoers{,.ori}
echo "zhangsan  ALL=(ALL)  NOPASSWD:ALL">>/etc/sudoers
visudo -c

usermod -G wheel zhangsan  #加入wheel组
useradd -g wheel wangwu && echo xdjr0lxGu@|passwd --stdin wangwu

for

for i in {1..5}; do  echo ${i}; done

文件下载

wget url/file
curl -O url/file
## 执行命令
curl -L https://raw.github.com/creationix/nvm/master/install.sh | sh
wget -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh

临时修改Linux字符集

export LANG=en_US.UTF-8 
echo $LANG  #查看字符集

标识环境

[root@15b883(PRO)~]# tail -6 /etc/profile
export BIZENVFLAG=0     #生产环节
#export BIZENVFLAG=9     #开发环境
case $BIZENVFLAG in
 0) PS1='[\u@\h(\e[31;47mPRO\e[m)\W]\$ ';;
 9) PS1='[\u@\h(DEV)\W]\$ ';;
esac
[root@15b883(PRO)~]#
[root@15b883(PRO)~]#

查看本地私网IP

echo $(ip addr show eth0 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)

随机生成32字符串

tr -dc 'a-zA-Z0-9~!@#$%^&*_()+}{?></";.,[]=-' < /dev/urandom | fold -w 32 | head -n 1

杀掉运行8080端口的进程

lsof -i :8080 | awk '{l=$2} END {print l}' | xargs kill

显示每个IP到端口80的连接数量

clear;while x=0; do clear;date;echo "";echo "  [Count] | [IP ADDR]";echo "-------------------";netstat -np|grep :80|grep -v LISTEN|awk '{print $5}'|cut -d: -f1|uniq -c; sleep 5;done

ssh config

shh server10
 ~/.ssh/config
Host server10
  Hostname 1.2.3.4
  IdentityFile ~/backups/.ssh/id_dsa
  user foobar
  Port 30000
  ForwardX11Trusted yes
  TCPKeepAlive yes

列出头十个最耗内存的进程

ps aux | sort -nk +4 | tail

Python实现http服务

python -m SimpleHTTPServer

一句话实现一个HTTP服务,把当前目录设为HTTP服务目录,可以通过http://localhost:8000访问 这也许是这个星球上最简单的HTTP服务器的实现了。

查看公网IP(本地\公有云都能看到)

http://ifconfig.io/
curl http://ifconfig.io/
curl ip.sb

JDK

export PATH=/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/ibutils/bin:/root/bin

cat >>/etc/profile<<EOF
export JAVA_HOME=/usr/local/jdk1.8.0_212
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH
EOF
posted @ 2020-06-10 21:52  宋某人  阅读(648)  评论(0编辑  收藏  举报