随笔分类 - linux shell
摘要:linux中当目录具有SGID权限时, 任何用户在该目录中创见的文件将自动继承该目录的所属组。 测试。 1、普通用户家目录创建一个普通文件, 观察文件的所属组 [liujiaxin01@rhel7pc1 ~]$ ls [liujiaxin01@rhel7pc1 ~]$ whoami liujiaxi
阅读全文
摘要:1、问题 2、解决方法,切换至root用户,修改/etc/sudoers配置文件 [root@rhel7pc1 ~]# vim /etc/sudoers ………… ## The COMMANDS section may have other options added to it. ## ## Al
阅读全文
摘要:1、linux中文件或者目录的权限针对用户分为三类,即: 所有者,用u表示; 所属组,用g表示; 其他人,用o表示; 针对每一种用户,权限有可以分为三种,即: 读的权限,用r表示,也用数字4代替。 写的权限,用w表示,也用数字2代替。 执行的权限,用x表示,也用数字1代替。 2、举例 文件a.txt
阅读全文
摘要:1、 -: 普通文件。 d: 目录文件。 l: 链接文件。 例如:软连接 b: 块设备文件 例如:硬盘 c: 字符设备文件 例如: 系统外设, 鼠标、键盘等。 p: 管道文件 ???
阅读全文
摘要:1、 [root@rhel7pc1 test]# ls a.txt [root@rhel7pc1 test]# cat a.txt 1 k d f 2 x c g 3 z c b 4 f i j 5 e d g 6 i j e [root@rhel7pc1 test]# sed '/x/, +1d'
阅读全文
摘要:1、 [root@rhel7pc1 test]# ls a.txt [root@rhel7pc1 test]# cat a.txt 1 k d f 2 x c g 3 z c b 4 e w e 5 z c x 6 e d g 7 i j e [root@rhel7pc1 test]# grep -
阅读全文
摘要:1、 [root@rhel7pc1 test]# ls a.txt [root@rhel7pc1 test]# cat a.txt 1 k d f 2 x c g 3 z c b 4 e w e 5 z c f 6 e d g [root@rhel7pc1 test]# sed -n '/x/{n;
阅读全文
摘要:1、测试数据 [root@rhel7pc1 test]# ls a.txt [root@rhel7pc1 test]# cat a.txt ## 测试数据 1 k d f 2 x c g 3 z c b 4 e w e 5 z c f 6 e d g 2、删除匹配行及其下一行 [root@rhel7
阅读全文
摘要:1、测试数据 [root@rhel7pc1 test]# ls test.txt [root@rhel7pc1 test]# cat test.txt e 5435.1 f d f 1 j k d f e u d j 1 j [root@rhel7pc1 test]# sed -n l test.t
阅读全文
摘要:1、测试数据 [root@centos7 test]# ls test.txt [root@centos7 test]# cat test.txt ## 测试数据 y j k j k h d j r [root@centos7 test]# sed -n l test.txt y\tj k$ \t\
阅读全文
摘要:1、测试数据 [root@centos7 test]# ls test.txt [root@centos7 test]# cat test.txt y j k j k h d j r [root@centos7 test]# sed -n l test.txt ## 测试数据 y\t\tj k$ j
阅读全文
摘要:1、测试数据 [root@centos7 test]# ls test.txt [root@centos7 test]# cat test.txt ## 测试数据 d j m d j y i [root@centos7 test]# sed -n l test.txt ## 查看分割符 d j m$
阅读全文
摘要:1、测试数据 [root@centos7 test]# ls test.txt [root@centos7 test]# cat test.txt ## 测试数据 k m w g h g u y [root@centos7 test]# sed -n l test.txt ## 查看tab键 k\t
阅读全文
摘要:1、 创建规律性计划任务: crontab -e 查看规律性计划任务:crontab -l 删除规律性计划任务:crontab -r 时间格式:分 时 月 年 星期 命令 实例: 1、创建规律性计划任务服务 [root@centos7 test]# crontab -e ## 输入该命令之后进入编辑
阅读全文
摘要:1、问题 paste异常 [root@centos7 test]# ls test.ped test.txt [root@centos7 test]# cat test.txt 10 YH 1 GS 11 YH [root@centos7 test]# cat test.ped 10 10 0 0
阅读全文
摘要:1、创建计划任务服务 [root@centos7pc1 test2]# ls [root@centos7pc1 test2]# date Wed Apr 6 17:16:12 CST 2022 [root@centos7pc1 test2]# at now+2 min ## 设置任务时间, 2分钟后
阅读全文
摘要:1、 [root@centos7pc1 test2]# ls test.sh [root@centos7pc1 test2]# cat test.sh ## 测试脚本 #!/bin/bash read -p "please input an number or an letter: " KEY ca
阅读全文
摘要:1、 [root@centos7pc1 test2]# ls test.sh [root@centos7pc1 test2]# cat test.sh ## 脚本 #!/bin/bash for i in `seq 9` do for j in `seq 9` do echo "$i * $j" |
阅读全文
摘要:1、 [root@rhel7pc1 test]# echo "xxx" xxx [root@rhel7pc1 test]# echo -n "xxx" ## -n选项实现不换行输出 xxx[root@rhel7pc1 test]#
阅读全文
摘要:1、 [root@rhel7pc1 test]# ls test.sh [root@rhel7pc1 test]# cat test.sh #!/bin/bash NUM=10 while [ $NUM -gt 0 ] ## 循环条件 do echo "$NUM xxxx" let NUM-- ##
阅读全文