随笔分类 -  linux shell

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 78 下一页
摘要:001、位置锚定(开头或者结尾): ^: 表示锚定开头 $:表示锚定结尾 \<:表示匹配单词的开端 \>:表示匹配单词的结尾 \<word\>:表示匹配完整的单词 002、匹配次数1 .: 当个.表示匹配任意字符1次 ?: 表示匹配前一个字符0次或者1次 +:表示匹配前一个字符一次或者多次 *:表示 阅读全文
posted @ 2023-09-21 22:20 小鲨鱼2018 阅读(187) 评论(0) 推荐(0)
摘要:001、 ps -aux | grep "fastq-dump" 阅读全文
posted @ 2023-09-21 16:03 小鲨鱼2018 阅读(52) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test2]# ls test.sh [root@pc1 test2]# cat test.sh ## 测试程序 #!/bin/bash seq 10 > a.txt xxxxxx && echo 20 done ; rm a.txt [root@pc1 test2]# 阅读全文
posted @ 2023-09-21 11:06 小鲨鱼2018 阅读(112) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test2]# ls [root@pc1 test2]# str1="ab.cd_kk.mn_jjy" ## 测试字符串 [root@pc1 test2]# echo ${str1%%.*} ## 从左侧开始,删除.号右侧所有的内容 ab [root@pc1 test2 阅读全文
posted @ 2023-09-20 17:58 小鲨鱼2018 阅读(243) 评论(0) 推荐(0)
摘要:001、测试文件(实现仅提取==1185== 和 其他不包含==数字==的行) [root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试文件 ==1185== abcadoiafa ==1120== asvgaoj fajsdfja = 阅读全文
posted @ 2023-09-20 11:59 小鲨鱼2018 阅读(89) 评论(0) 推荐(0)
摘要:[root@pc1 test2]# ls ##测试数据 a.txt b.csv c.ped test_dir [root@pc1 test2]# ls test_dir/ [root@pc1 test2]# find ./ -name "*.txt" -o -name "*.ped" -exec c 阅读全文
posted @ 2023-09-20 08:53 小鲨鱼2018 阅读(778) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test2]# ls [root@pc1 test2]# basename /home/test2/a.txt ## 仅仅获取文件 a.txt [root@pc1 test2]# dirname /home/test2/a.txt ## 仅仅获取路径 /home/tes 阅读全文
posted @ 2023-09-20 08:30 小鲨鱼2018 阅读(19) 评论(0) 推荐(0)
摘要:001、 删除最后一列 [root@pc1 test4]# ls a.txt [root@pc1 test4]# cat a.txt ## 测试文件 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 阅读全文
posted @ 2023-09-19 21:36 小鲨鱼2018 阅读(2210) 评论(0) 推荐(0)
摘要:001、 方法1 [root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试文件 /home/test2/a.txt [root@pc1 test2]# sed -r 's/(\/.*\/).*/\1/' a.txt ## 仅保留路径 / 阅读全文
posted @ 2023-09-19 20:22 小鲨鱼2018 阅读(129) 评论(0) 推荐(0)
摘要:对目录进行粘滞位设置,实现用户只能删除自己的文件,而不能删除别人的文件。 文件能否被删除并不取决于自身的权限,而是看其所在目录是否有写入权限。 001、 [root@pc1 home]# ls liujiaxin01 liujiaxin02 [root@pc1 home]# whoami ## 当前 阅读全文
posted @ 2023-09-18 21:53 小鲨鱼2018 阅读(71) 评论(0) 推荐(0)
摘要:setfacl(set file access control lists)设置文件访问控制列表。 文件的ACL(访问控制列表)提供的是在所有者、所属组、其他人的读、写、执行权限以外的特殊权限控制,使用setfacl命令可以针对 单一用户或用户组、单一文件或者目录来进行、读、写、执行的控制。 001 阅读全文
posted @ 2023-09-17 10:36 小鲨鱼2018 阅读(1321) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test1]# ls ## 三个测试文件 a.txt b.txt testfile [root@pc1 test1]# ll -h total 4.0K lrwxrwxrwx. 1 root root 20 Sep 16 12:03 a.txt -> /home/tes 阅读全文
posted @ 2023-09-15 12:06 小鲨鱼2018 阅读(179) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test1]# ls ## 测试文件 a.txt a.TXT c.csv c.tXt d.txt e.Txt f.csv k.map [root@pc1 test1]# find ./ -name "*.txt" ## 显示相对路径 ./a.txt ./d.txt [r 阅读全文
posted @ 2023-09-15 11:58 小鲨鱼2018 阅读(1932) 评论(0) 推荐(0)
摘要:001、 -iname选项 实现忽略大小写查找 [root@pc1 test1]# ls ## 测试文件 a.txt a.TXT c.csv c.tXt d.txt e.Txt f.csv k.map [root@pc1 test1]# find ./ -name "*.txt" ## 一般查找 . 阅读全文
posted @ 2023-09-15 11:48 小鲨鱼2018 阅读(217) 评论(0) 推荐(0)
摘要:001、 针对普通用户 [liujiaxin01@pc1 ~]$ ls test01 [liujiaxin01@pc1 ~]$ pwd ## 普通用户家目录 /home/liujiaxin01 [liujiaxin01@pc1 ~]$ tree ## 重要文件所在目录 . └── test01 └─ 阅读全文
posted @ 2023-09-13 22:49 小鲨鱼2018 阅读(181) 评论(0) 推荐(0)
摘要:001、方法1 [root@pc1 test01]# ls a.txt b.txt [root@pc1 test01]# cat a.txt 1 2 3 4 5 6 [root@pc1 test01]# cat b.txt a b c d e f [root@pc1 test01]# paste - 阅读全文
posted @ 2023-09-13 18:04 小鲨鱼2018 阅读(285) 评论(0) 推荐(1)
摘要:001、 提取两个文件中指定列相同的行 [root@pc1 test01]# ls file1 file2 [root@pc1 test01]# cat file1 a rs1 b rs2 c rs4 [root@pc1 test01]# cat file2 a 0.170721 -1.82031 阅读全文
posted @ 2023-09-13 17:36 小鲨鱼2018 阅读(662) 评论(0) 推荐(0)
摘要:001、 awk [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt a ii b kk a jj c yy b 77 e tt [root@pc1 test02]# awk '!ay[$1]++' a.txt a ii b kk c y 阅读全文
posted @ 2023-09-13 11:37 小鲨鱼2018 阅读(653) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试文件 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 [root@pc1 test02]# c 阅读全文
posted @ 2023-09-12 23:53 小鲨鱼2018 阅读(115) 评论(0) 推荐(0)
摘要:001、 [root@pc1 test02]# ls a.sh b.sh [root@pc1 test02]# cat a.sh ## 测试程序1 #!/bin/bash str1="ab_cd_ef" tmp1=$(echo $str1 | sed 's/_/\n/g') echo $tmp1 [ 阅读全文
posted @ 2023-09-12 23:33 小鲨鱼2018 阅读(177) 评论(0) 推荐(0)

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 78 下一页