Shell

学到了_shell脚本编写

# 背景提要 由于需要在linux command line界面频繁的启动和关闭某个服务,愚蠢的我一直使用人力进行枯燥的工作 经高人指点——“为什么不写个脚本跑呢”,顿茅塞顿开,再次鄙视下愚蠢的自己 # 开始干活 所有可以在commad line界面敲的命令都可以集合到一个 .sh脚本中进行,并可以 ......
脚本 shell

LINUX系列-shell脚本篇

#### 一 批量创建用户 [root@iZbp1el3hto8hhgtlih1m4Z test]# vi 1_useradd_piliang.sh #!/bin/bash #第一步获取到创建用户的名称,这里使用前台输入 USER_LIST=$@ #存放创建好的用户和密码 USER_FILE=./n ......
脚本 LINUX shell

shell编程

# shell ## 什么是shell? ​ shell就是基于用户和操作系统内核之间的一个应用程序,可以让用户更简单高效安全地使用和操作linux内核。 ​ shell是像javaScript,python一样,都是**解释性语言**(脚本语言),一边解释一边执行,不会生成任何可执行文件。 ## ......
shell

shell脚本

备份数据库 #!/bin/bash###申明变量d=`date '+%Y%m%d'`USER_PT="root"PASS_PT="Cnbm123456!"USER_ZT="root"PASS_ZT="qtmscpv2468"PT_PATH=/data/PingTai_V3/mysql/pt_sqlb ......
脚本 shell

shell中的#%*处理字符用法【转】

shell提供了简单强大字符串处理方式,有时候需要对path进行处理,通过#%*的搭配使用,可以方便快捷的得到结果。废话少说,举例子。 #!/usr/bin/env bash DIR="/dir1/dir2/dir3/abc.def.txt" echo "DIR: $DIR" #删除最左边/及其左边 ......
字符 shell

shell一键部署集群初始化环境

用于一键部署集群(多节点)的环境初始化,如修改主机名,禁用防火墙、selinux、iptables,主机映射,节点相互免密,时间同步等 ......
集群 环境 shell

Some details for the Shell which I think is important

拼接字符串, 在定义好变量之后, 输出时候的拼接, 注意无意输出一些空格 。 比如: #!/bin/bash a1="China" a2="${a1}, Japan and Korean are the three important countries in east asia. \n" a3=" ......
important details Shell which think

Linux shell command ln All In One

# Linux shell command ln All In One > 硬连接 vs 软连接 ## ln ```sh $ man ln > ./man-docs/ln.md $ cat ./man-docs/ln.md ``` ```sh LN(1) User Commands LN(1) NA ......
command Linux shell All One

Linux shell command cut All In One

Linux shell command cut All In One cut 截取指定符号等号后面的字符串 cut 截取等号后面的字符串 ......
command Linux shell All One

window系统的power shell 和 Linux Ubuntu 的命令行各自特点和优缺点

PowerShell 是 Windows 系统自带的命令行工具,而 Linux Ubuntu 的命令行则是 Linux 系统的标准命令行工具。它们的特点和优缺点如下: PowerShell 特点和优缺点: 特点: 1. 支持对象管道,可以将命令的输出作为对象进行处理,方便进行脚本编写和自动化处理。 ......
优缺点 命令 特点 window Ubuntu

Linux常用的shell命令

shell linux命令行就是由shell提供的,shell其实是所有命令行程序的统称,而CentOS系统中默认使用的shell程序就是bash,他是linux系统中运行的一种特殊程序,其文件位于/bin/bash,用户在登录linux系统时,系统就会自动加载一个shell程序,在用户和内核之间充 ......
命令 常用 Linux shell

Debian11安装GNOME-TWEAKS报错WARNING : Shell not installed or running

先写结论:打开方式是按下Alt+F2弹出命令窗输入gnome-tweaks,就会弹出优化界面,点击扩展就可以按需开启扩展插件。 还有一种方法,如果你在安装debian11系统时安装完了GNOME,那么你可以在显示应用程序内找到一个叫工具的软件合集,内有名叫优化的程序。 闲聊:不过其实一开始我就注意到 ......

Shell(Linux)手册-awk

## 资料来源 [awk知识点总结 | 骏马金龙](https://www.cnblogs.com/f-ck-need-u/p/7509812.html "awk知识点总结 | 骏马金龙") [精通awk系列 | 骏马金龙](https://www.cnblogs.com/f-ck-need-u/p ......
手册 Shell Linux awk

Linux Shell常用小技巧

### 1.批量替换文件中匹配字符串 ```sh sed -i 's/@[^-i 表示在原始文件中直接修改,而不是输出到标准输出 > >s/ 表示替换操作的开始 > >@\[^ >// 表示替换成空字符,也表示删除 > >g 表示全局替换,即文件中的每一处匹配字符串都会被替换 ### 2.打印输出的 ......
常用 技巧 Linux Shell

shell

### 字符拼接 ``` #!/bin/bash name="Shell" url="http://c.biancheng.net/shell/" str1=$name$url #中间不能有空格 str2="$name $url" #如果被双引号包围,那么中间可以有空格 str3=$name": " ......
shell

kprobe_events shell模式使用教程

kprobe_events shell模式使用教程kprobe 使用前提 需要内核启用以下配置 CONFIG_KPROBES=y CONFIG_HAVE_KPROBES=y CONFIG_KPROBE_EVENT=y kprobe_events kprobe_events有两种类型:kprobe,k ......
kprobe_events 模式 教程 kprobe events

linux shell脚本函数

目录 一、函数 二、返回值 三、终止符 四、实验 一、函数 概念:函数是定义一个函数名,可以调用函数方法,完成便捷处理。 函数作用: 1.避免方法名重复。 2.将代码分割成一块一块,便于查看。 例子演示: 加法 二、返回值 return:返回值 作用:继续执行脚本 范围:0-255,(超过255取余 ......
脚本 函数 linux shell

Shell(Linux)手册-sed

## 资料来源 [sed修炼系列 | 骏马金龙](https://www.cnblogs.com/f-ck-need-u/p/7488469.html "sed修炼系列 | 骏马金龙") [sed命令 | runoob](https://www.runoob.com/linux/linux-comm ......
手册 Shell Linux sed

Shell test 命令

# 数值测试 | 参数 | 说明 | | | | | -eq | 等于则为真 | | -ne | 不等于则为真 | | -gt | 大于则为真 | | -ge | 大于等于则为真 | | -lt | 小于则为真 | | -le | 小于等于则为真 | # 字符串测试 | 参数 | 说明 | | | ......
命令 Shell test

shell命令:getevent和sendevent

1.getevent输出所有event设备的基本信息 输出格式:设备名: 事件type 事件code 事件value注意:这里的数字都是16进制。 getevent -c 10 //输出10条信息后退出getevent -l //将type、code、value以对应的常量名称显示使用 geteve ......
sendevent getevent 命令 shell

shell脚本用来定时删除一些文件以及date的一些加减操作

date命令加减操作:date +%Y%m%d #显示当天年月日date -d “+1 day” +%Y%m%d #显示明天的日期date -d “-1 day” +%Y%m%d #显示昨天的日期date -d “-1 month” +%Y%m%d #显示上一月的日期date -d “+1 mont ......
脚本 文件 shell date

【博学谷学习记录】超强总结,用心分享 | shell基础

【博学谷IT技术支持】 # 一、shell简介 - `shell` 是一种编写脚本程序的语言,常用于`linux`, - `shell`是解释型语言,相对于其他的语言更加好学,它的语法和结构也比较简单 - 通过编写脚本,能显著的提高开发的效率 # 二、shell的基础知识 每个`sh`文件都有这个开 ......
基础 shell

shell脚本中特殊筛选文件

问题描述:在写shell中,总会遇到一些各式各样筛选文件的需求,整理了一些特殊情况 1.查找目标文件下大于100Mb的文件 find $target_dir -type f -size +70M 2.查找目标文件下大于100Mb的文件,并显示详细信息 find $target_dir -type f ......
脚本 文件 shell

shell脚本语言

## shell文件后缀 > xxx.sh ## shell编程的的开头 > #!/bin/bash ## shell的执行方式 ![](https://img2023.cnblogs.com/blog/2330250/202305/2330250-20230531162903619-7772750 ......
脚本 语言 shell

linux C中调用shell命令和运行shell脚本

1、system(执行shell 命令) 相关函数 fork,execve,waitpid,popen表头文件 #include<stdlib.h>定义函数 int system(const char * string);函数说明 system()会调用fork()产生子进程,由子进程来调用/bin ......
shell 脚本 命令 linux

Linux shell standard input bugs All In One

# Linux shell standard input bugs All In One ## error ❌ > `warning: file '', around line 110: table wider than line width` ```sh $ man vcgencmd > vcge ......
standard Linux shell input bugs

【shell】ubuntu循环输出当前日期

1、场景 我想实时输出当前系统时间,对比日志之间的时间差 2、方法 #!/bin/bash while(true) do echo $(date +%F%n%T) sleep 1 done 3、date命令参数 ~$ date --help Usage: date [OPTION]... [+FOR ......
日期 ubuntu shell

Linux shell command base64 All In One

Linux shell command base64 All In One email address encryption / 邮箱地址加密 应用场景 防止爬虫爬取邮箱地址发送垃圾邮件 base64 encode & decode ......
command Linux shell base All

小括号() 大括号{}在linux shell中的作用

1.小括号() a.另开子shell运行命令比如 (ls;ls -h;pwd); b.参数替换,类似于 ``; 2.大括号 {} a.参数收拢 比如 ls {a,b,c}.txt {1...3}.txt b.在当前shell中执行命令{ ls; pwd;},需要注意左大括号与第一条命令有空格,最后一 ......
括号 作用 linux shell

How to use the shell command to get the version of Linux Distributions All In One

How to use the shell command to get the version of Linux Distributions All In One 如何使用 shell 命令获取 Linux 发行版的版本 hostnamectl cat /etc/os-release lsb_rel... ......
Distributions the command version shell