![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
linux
码农~磐石
这个作者很懒,什么都没留下…
展开
-
shell学习(五)
文本排序及统计 ls列表顺序 默认按字母升序排列 -S:按文档大小降序排列 -t:按文档的修改时间降序排列- -r :反序排列 [root@localhost test]# ls -lh -S demo*.sh //ls -lh 显示文件大小 -rw-r--r-- 1 root root 334 9月 26 14:18 demo14.sh -rw-r--r-- 1 root root 183 9月 26 14:42 demo15.sh -rw-r--r-- 1 root root 176 9月原创 2021-09-27 11:01:59 · 45 阅读 · 0 评论 -
linux 常用命令
命令 作用 who | wc -l 当前系统登录用户数 pgrep ‘’ | wc -l 开启进程数 pwd 当前所在目录路径 ping -c 3 -i 0.2 -W 3 192.168.100.22 &>/dev/null ping 192.168.100.22 -c 3 表示发送3次 ; -i 0.2表示每0.2秒发送一次;-W 3 表示等待3秒 vim /etc/passwd 用户 $# 在shell脚本中使用表示执行shell 输入的参数个数...原创 2021-09-26 16:38:16 · 61 阅读 · 0 评论 -
shell学习(四)
流程控制 if [root@localhost test]# cat demo12.sh #!/bin/bash SSH_TEST_DIR="/opt/test22/" if [ ! -d $SSH_TEST_DIR ] then mkdir -p $SSH_TEST_DIR fi [root@localhost test]# sh demo12.sh [root@localhost test]# ls -d /opt/test22 /opt/test22 #!/bin/bash ping -c原创 2021-09-26 16:07:49 · 54 阅读 · 0 评论 -
shell学习(三)
条件测试 test检查文件状态 [root@localhost test]# test -e demo11.sh && echo true true [root@localhost test]# test 1 -eq 2 || echo false false [root@localhost test]# [ $USESR='root' ] && echo $USER root原创 2021-09-26 11:37:58 · 54 阅读 · 0 评论 -
shell学习(二)
字符串处理 截取字符串 expr:expr substr $var1 起始位置截取长度 [root@localhost test]# expr substr "hello shell" 7 5 shell cut: cut -c起始位置-结束位置;cut -d '分隔符’-f 字段编号… [root@localhost test]# cat demo10.sh #!/bin/bash var1="Centos8.1" echo $var1 | cut -c 5-7 #简略用法,缺省从1开始 ech原创 2021-09-26 11:08:56 · 70 阅读 · 0 评论 -
shell学习(一)
shell执行方式调试免交互及输出处理组合命令变量变量值及范围控制数值运算及处理 参考学习视频地址: https://www.bilibili.com/video/BV1sq4y1K7nM?p=1 #!/bin/bash 声明shell环境 #create user 注释 echo 'create user as testuser'; useradd testuser 2> /tmp/err.log #update password echo 'update password for te原创 2021-09-24 16:51:38 · 222 阅读 · 0 评论