![](https://img-blog.csdnimg.cn/20200610154153414.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Shell
站长常用Shell脚本整理分享
转自:https://www.kancloud.cn/microcloud/btcn/1505273
北观止
欢迎留言讨论,期待与你共同进步
展开
-
shell脚本加密工具shc
shell脚本加密工具shc原创 2020-08-30 12:54:51 · 473 阅读 · 0 评论 -
Bash scripting
title: Bash scriptingcategory: CLIlayout: 2017/sheettags: [Featured]updated: 2019-10-02keywords:VariablesFunctionsInterpolationBrace expansionsLoopsConditional executionCommand substitution摘选自:https://github.com/rstacruz/cheatsheets项目的bash..转载 2020-10-11 18:52:14 · 454 阅读 · 0 评论 -
Shell脚本实现自动登录服务器
1.登录脚本login_server.sh#!/bin/bash# ReferenceLink:https://yq.aliyun.com/articles/516347#show all host infos of serverList.txtif [[ -f ./serverList.txt ]]then hostNum=`cat ./serverList.txt | wc -l`else echo "No .serverList.txt in ./ dir, please原创 2020-06-11 19:24:27 · 1498 阅读 · 0 评论 -
站长常用Shell脚本整理分享(全)
站长常用Shell脚本整理分享站长常用Shell脚本整理分享1-10站长常用Shell脚本整理分享11-20站长常用Shell脚本整理分享21-30站长常用Shell脚本整理分享31-40站长常用Shell脚本整理分享41-50站长常用Shell脚本整理分享51-59长期更新...原创 2020-06-11 19:25:21 · 291 阅读 · 0 评论 -
站长常用Shell脚本整理分享51-59
51、一键配置 VNC 远程桌面服务器(无密码版本)#!/bin/bash# 一键配置 VNC 远程桌面服务器(无密码版本) # 脚本配置的 VNC 服务器,客户端无需密码即可连接# 客户端仅有查看远程桌面的权限,没有鼠标和键盘的操作权限 rpm --quiet -q tigervnc‐serverif [ $? -ne 0 ];then yum -y tigervnc‐serverfix0vncserver AcceptKeyEvents=0 AlwaysShared=1 \转载 2020-10-11 18:48:04 · 358 阅读 · 0 评论 -
站长常用Shell脚本整理分享41-50
41、统计 Linux 进程相关数量信息#!/bin/bash# 统计 Linux 进程相关数量信息 running=0sleeping=0stoped=0zombie=0# 在 proc 目录下所有以数字开始的都是当前计算机正在运行的进程的进程 PID# 每个 PID 编号的目录下记录有该进程相关的信息for pid in /proc/[1‐9]*do procs=$[procs+1] stat=$(awk '{print $3}' $pid/stat)# 每个 pid 目录转载 2020-10-11 18:47:23 · 267 阅读 · 0 评论 -
站长常用Shell脚本整理分享31-40
31、显示当前计算机中所有账户的用户名称 #!/bin/bash # 显示当前计算机中所有账户的用户名称 # 下面使用3种不同的方式列出计算机中所有账户的用户名# 指定以:为分隔符,打印/etc/passwd 文件的第 1 列awk -F: '{print $1}' /etc/passwd # 指定以:为分隔符,打印/etc/passwd 文件的第 1 列cut -d: -f1 /etc/passwd # 使用 sed 的替换功能,将/etc/passwd 文件中:后面的所有内容替换转载 2020-10-11 18:47:00 · 266 阅读 · 0 评论 -
站长常用Shell脚本整理分享21-30
21、检查特定的软件包是否已经安装#!/bin/bash# 检查特定的软件包是否已经安装 if [ $# -eq 0 ];then echo "你需要制定一个软件包名称作为脚本参数" echo "用法:$0 软件包名称 ..."fi# $@提取所有的位置变量的值,相当于$*for package in "$@"do if rpm -q ${package} &>/dev/null ;then echo -e "${package}\033[32m 已经安装\03转载 2020-10-11 18:46:23 · 314 阅读 · 0 评论 -
站长常用Shell脚本整理分享11-20
11、编写 nginx 启动脚本#!/bin/bash# 编写 nginx 启动脚本 # 本脚本编写完成后,放置在/etc/init.d/目录下,就可以被 Linux 系统自动识别到该脚本# 如果本脚本名为/etc/init.d/nginx,则 service nginx start 就可以启动该服务# service nginx stop 就可以关闭服务# service nginx restart 可以重启服务# service nginx status 可以查看服务状态 progra转载 2020-10-11 18:45:16 · 239 阅读 · 0 评论 -
站长常用Shell脚本整理分享1-10
https://www.kancloud.cn/microcloud/btcn/15052731、编写hello world脚本#!/bin/bash# 编写hello world脚本echo "Hello World!"2、统计当前 Linux 系统有登录权限的账号数#!/bin/bash# 统计当前 Linux 系统中可以登录计算机的账户数量grep "bash$" /etc/passwd | wc -l3、批量修改扩展名脚本#!/bin/bash# 编写批量修改扩展名脚.转载 2020-10-11 18:44:42 · 404 阅读 · 0 评论