随笔分类 -  linux shell

上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 77 下一页
摘要:1、expr命令实现在命令行中的四则运算 [root@centos7pc1 test3]# ls [root@centos7pc1 test3]# expr 10 + 5 ## 数字和运算符的两侧必须有空格 15 [root@centos7pc1 test3]# expr 10+5 10+5 [ro 阅读全文
posted @ 2022-04-02 11:57 小鲨鱼2018 阅读(610) 评论(0) 推荐(0)
摘要:1、测试数据 [root@centos7pc1 test3]# ls a.txt [root@centos7pc1 test3]# cat a.txt ddfg uujj mmkk xxuu zzdd mmuh zzvv ddee 2、sed实现 [root@centos7pc1 test3]# l 阅读全文
posted @ 2022-04-02 11:10 小鲨鱼2018 阅读(215) 评论(0) 推荐(0)
摘要:1、直接测试 [root@centos7pc1 test3]# ls [root@centos7pc1 test3]# a=10 [root@centos7pc1 test3]# echo $a 10 [root@centos7pc1 test3]# b=a+5 ## 变量没有$则直接输出了变量名 阅读全文
posted @ 2022-04-02 10:10 小鲨鱼2018 阅读(407) 评论(0) 推荐(0)
摘要:1、测试数据 [root@centos7pc1 test3]# ls a.txt [root@centos7pc1 test3]# cat a.txt GGTGCAATAT GGTGCAATAT GGTGCAATAT GGTGCAATAT 2、将连续的字符转换为中间具有空格的字符 [root@cen 阅读全文
posted @ 2022-04-02 09:18 小鲨鱼2018 阅读(84) 评论(0) 推荐(0)
摘要:1、查看系统 [root@centos7pc1 test3]# cat /etc/redhat-release CentOS Linux release 7.9.2009 (Core) [root@centos7pc1 test3]# lsb_release -a LSB Version: :cor 阅读全文
posted @ 2022-04-01 17:46 小鲨鱼2018 阅读(484) 评论(0) 推荐(0)
摘要:1、iP清单、脚本 [root@centos7pc1 test2]# ls ip.txt test.sh [root@centos7pc1 test2]# cat ip.txt www.baidu.com xxxxx www.jd.com yyyyy www.sina.com zzzzz 192.1 阅读全文
posted @ 2022-04-01 16:15 小鲨鱼2018 阅读(205) 评论(0) 推荐(0)
摘要:1、创建用户列表 [root@centos7pc1 home]# seq -f liujiaxin%02g 2 10 liujiaxin02 liujiaxin03 liujiaxin04 liujiaxin05 liujiaxin06 liujiaxin07 liujiaxin08 liujiax 阅读全文
posted @ 2022-04-01 15:39 小鲨鱼2018 阅读(1098) 评论(0) 推荐(0)
摘要:1、linux中if条件判断语句,基本结构: if 条件判断语句 then command fi [root@centos7pc1 test2]# ls test.sh [root@centos7pc1 test2]# cat test.sh ## 脚本文件 #!/bin/bash if [ ! - 阅读全文
posted @ 2022-04-01 09:39 小鲨鱼2018 阅读(6331) 评论(0) 推荐(0)
摘要:1、查看系统中当前的所有用户 [root@centos7pc1 test2]# grep bash /etc/passwd root:x:0:0:root:/root:/bin/bash liujiaxin01:x:1000:1000:liujiaxin01:/home/liujiaxin01:/b 阅读全文
posted @ 2022-04-01 09:25 小鲨鱼2018 阅读(510) 评论(0) 推荐(0)
摘要:1、系统 [root@centos7pc1 test2]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-n 阅读全文
posted @ 2022-04-01 09:08 小鲨鱼2018 阅读(3401) 评论(0) 推荐(0)
摘要:1、逻辑与&&: 在前面语句执行成功时才执行后面的语句 [root@rhelpc1 test]# ls a.txt [root@rhelpc1 test]# wc -l a.txt 0 a.txt [root@rhelpc1 test]# wc -l a.txt && echo OK ## 逻辑与& 阅读全文
posted @ 2022-03-29 16:27 小鲨鱼2018 阅读(447) 评论(0) 推荐(0)
摘要:1、 $0: 当前的shell文件名 $#: 一共包含几个参数 $*: 所有的参数 $?:上一步执行的结果,成功执行返回0,不成功执行返回1或其他 $1: 第一个参数 $2:第二个参数 $3: 第三个参数 测试: [root@rhelpc1 test]# ls test.sh [root@rhelp 阅读全文
posted @ 2022-03-29 15:49 小鲨鱼2018 阅读(123) 评论(0) 推荐(0)
摘要:1、测试 [root@rhelpc1 test2]# ls [root@rhelpc1 test2]# seq 10 > a.txt [root@rhelpc1 test2]# ls a.txt [root@rhelpc1 test2]# cat a.txt ## 测试数据 1 2 3 4 5 6 阅读全文
posted @ 2022-03-29 15:46 小鲨鱼2018 阅读(480) 评论(0) 推荐(0)
摘要:1、行选择 vim file打开文件,在命令模式下输入大写V即可: 按方向键或数字+j/k可以实现行的选择。 2、列选择 vim file打开文件,命令模式下输入ctrl + v即可: 按方向键可以实现列选择。 阅读全文
posted @ 2022-03-29 14:32 小鲨鱼2018 阅读(4032) 评论(0) 推荐(0)
摘要:1、 删除当前行: dd 删除当前行及向下3行:3dd 或者 d3j 删除当前行及向上3行:d3k 删除当前行及到第1行:d1G 或者 d+gg 删除当前行到最后1行:dG 删除光标所在位置及到行末:d$ 或者D 删除光标所在位置到行首:d0 删除当前字符:x, 相当于delete键 删除当前字符: 阅读全文
posted @ 2022-03-28 22:37 小鲨鱼2018 阅读(2970) 评论(0) 推荐(0)
摘要:1、Shell 的变量,可以分为“环境变量”和“自定义变量”两种类型,两者的区别在于作用范围不同。环境变量可以在其进程的子进程中继续有效,而自定义变量的势力范围则无法延伸到其进程的子进程中。 [root@localhost test]# ls [root@localhost test]# A=100 阅读全文
posted @ 2022-03-28 21:59 小鲨鱼2018 阅读(269) 评论(0) 推荐(0)
摘要:1、直接使用type命令进行判断 [root@localhost test]# type pwd ## pwd是内部命令 pwd is a shell builtin [root@localhost test]# type plink ## plink是外部命令 plink is hashed (/ 阅读全文
posted @ 2022-03-27 22:17 小鲨鱼2018 阅读(228) 评论(0) 推荐(0)
摘要:1、创建别名命令 [root@localhost test]# pwd /home/test [root@localhost test]# abc bash: abc: command not found... [root@localhost test]# alias abc=pwd ## 创建别名 阅读全文
posted @ 2022-03-27 22:06 小鲨鱼2018 阅读(1051) 评论(0) 推荐(0)
摘要:双引号“”:不进行转义,保留变量属性。 单引号‘’:进行转义,使其成为单纯的字符串。 [root@localhost test]# A=10 [root@localhost test]# echo $A 10 [root@localhost test]# echo "number is $A" ## 阅读全文
posted @ 2022-03-27 21:51 小鲨鱼2018 阅读(3442) 评论(0) 推荐(0)
摘要:?:表示匹配任意一个。 *:表示匹配0个或任意多个 [root@localhost test]# ls ab ab1 ab12 ab123 [root@localhost test]# ls -l ab* ## *表示匹配0个或任意多个 -rw-r--r--. 1 root root 0 Mar 2 阅读全文
posted @ 2022-03-27 21:40 小鲨鱼2018 阅读(869) 评论(0) 推荐(0)

上一页 1 ··· 48 49 50 51 52 53 54 55 56 ··· 77 下一页