随笔分类 - linux shell
摘要:001、 [root@pc1 test1]# ls a.txt [root@pc1 test1]# cat a.txt ## 测试数据 a 8 b 8 a 4 a 6 b 2 c 8 c 1 ## 利用awk数组进行统计 [root@pc1 test1]# awk '{ay1[$1]++; ay2[
阅读全文
摘要:001、测试1 [root@pc1 test1]# ls [root@pc1 test1]# mkdir a/b/c ## mkdir创建连续目录,失败 mkdir: cannot create directory ‘a/b/c’: No such file or directory [root@p
阅读全文
摘要:001、输出首次出现的项 [root@pc1 test1]# ls test.map [root@pc1 test1]# cat test.map ## 测试数据 1 55910 1 85204 1 122948 2 167127 2 176079 2 361433 3 144010 3 19991
阅读全文
摘要:001、 输出最大项 (base) [b20223040323@admin1 test]$ ls a.txt (base) [b20223040323@admin1 test]$ cat a.txt ## 测试数据 a 88 a 76 b 88 c 10 b 777 c 200 a 87 c 150
阅读全文
摘要:001、判断元素存在于数组中 (base) [b20223040323@admin1 test]$ ls a.txt (base) [b20223040323@admin1 test]$ cat a.txt ## 测试数据 a 88 a 76 b 88 a 876 b 25 a 66 ## 判断元素
阅读全文
摘要:001、 [root@PC1 test1]# ls ## 准备两个测试文件 a.sh b.sh [root@PC1 test1]# cat a.sh ## a文件 #!/bin/bash echo $* [root@PC1 test1]# cat b.sh ## b文件 #!/bin/bash se
阅读全文
摘要:001、两者都可以表示shell脚本的所有参数,两者没有差异(不管是否增加双引号) 举例: a、不加双引号 [root@PC1 test1]# ls ## 准备了两个测试脚本 a.sh b.sh [root@PC1 test1]# cat a.sh ## a.sh的内容如下 #!/bin/bash
阅读全文
摘要:001、 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 准备一个测试数据 aa aa aa bb bb cc cc cc cc dd dd dd [root@pc1 test02]# awk '{ay[$1]++; print
阅读全文
摘要:001、测试文件 [root@pc1 test]# ls a.txt [root@pc1 test]# ll -h ## 测试文件 total 113M -rw-r--r--. 1 root root 113M Jan 9 12:03 a.txt 002、压缩文件(不保留源文件) [root@pc1
阅读全文
摘要:001、生成测试文件 [root@pc1 test]# ls [root@pc1 test]# seq -f %010g 10000000 > a.txt ## 测试文件 [root@pc1 test]# ll -h total 113M -rw-r--r--. 1 root root 113M J
阅读全文
摘要:001、测试数据 [root@pc1 test1]# cat a.txt ## 测试数据 ddf gge fff 99944 errorfff 8888 adfailee 32434 error kkk iiii ff2333 ERROR JJJ kkk FAiL jjj 002、忽略大小写;方法1
阅读全文
摘要:两者都适用在linux 中进行文件查找。 001、find 01、通过对目录、子目录遍历进行查找 02、支持各种条件,比如文件名、类型 -type、大小-size、所有者-user、权限-perm、时间-mtime等 03、结合-exec,支持后续的操作,比如删除、查看、压缩,重命名等 002、lo
阅读全文
摘要:linux 中 []和[[]]都支持逻辑判断,后者比前者功能更强大,比较符合通用的编程规则。 001、举一例子 [root@pc1 test1]# a=10 [root@pc1 test1]# b=200 [root@pc1 test1]# if [ $a == 10 ]; then echo "a
阅读全文
摘要:001、输出字符串 [root@pc1 test1]# ls [root@pc1 test1]# printf "hello world\n" ## 方法一 hello world [root@pc1 test1]# printf "%s\n" "hello world" ## 方法二 hello
阅读全文
摘要:001、测试数据 [root@pc1 test1]# ls a.txt [root@pc1 test1]# cat a.txt ## 测试数据 d_j j k d d_kk 002、不指定分隔符 [root@pc1 test1]# ls a.txt [root@pc1 test1]# cat a.t
阅读全文
摘要:001、paste [root@pc1 test1]# ls a.txt b.txt [root@pc1 test1]# cat a.txt ## 测试文件 01 02 03 04 05 06 07 08 09 10 [root@pc1 test1]# cat b.txt ## 测试文件 1 2 [
阅读全文
摘要:001、gemma软件编译安装报错如下: src/gemma.cpp:79:10: fatal error: openblas_config.h: No such file or directory 002、解决方法
阅读全文
摘要:01、 PD(待定): pending;表示在排队 02、CF(配置):configurating 03、R(运行):running 04、CG(完): 表示正在退出 05、CA(取消) 06、S:管理员正在挂起。
阅读全文
摘要:001、设置文件不能被修改,同时也不能删除给文件: chattr +i file a、修改 [root@pc1 test]# ls a.txt [root@pc1 test]# lsattr a.txt ## 查看隐藏属性无 a.txt [root@pc1 test]# chattr +i a.tx
阅读全文
摘要:001、id + 用户名 [root@pc1 ~]# id liujiaxin01 ## 查看用户liujiaxin01的用户信息 uid=1000(liujiaxin01) gid=1000(liujiaxin01) groups=1000(liujiaxin01) [root@pc1 ~]# i
阅读全文

浙公网安备 33010602011771号