随笔分类 - linux shell
摘要:001、 [root@PC1 test2]# ls a.txt [root@PC1 test2]# cat a.txt ## 测试文件 SVLEN=-100 SVTYPE=DEL SVLEN=-62 SVTYPE=RPL NTLEN=25 HOMSEQ=G SVLEN=-100 SVTYPE=DEL
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt ## 测试文件 243 fsab 989a 34b sa 1113 ab34 df3 add gabe kkkk abk [root@PC1 test]# sed 's/ /\n/g'
阅读全文
摘要:001、问题 (普通用户没有sudoer权限) 002、解决方法 [liujiaxin01@PC1 coreutils-8.32]$ su - root ## 切换至root用户 Password: Last login: Wed Sep 28 11:22:11 CST 2022 on pts/1
阅读全文
摘要:001、 [root@PC1 test]# ls a.txt [root@PC1 test]# cat a.txt h d w q g d t [root@PC1 test]# sed -n "$a,$b"p a.txt ## 同时传入两个变量参数 d w q
阅读全文
摘要:001、 [root@PC1 test]# ls 10.txt 1.txt 4.txt 7.txt a.txt [root@PC1 test]# rm -f {0..9}* ## 删除当前目录中所有以数字开头的文件 [root@PC1 test]# ls a.txt
阅读全文
摘要:在文件的行首添加一行。 001、 echo 实现 [root@PC1 test2]# ls a.txt [root@PC1 test2]# cat a.txt ## 测试文件 a b c [root@PC1 test2]# echo "xxx" | cat - a.txt ## echo实现 xxx
阅读全文
摘要:001、 (base) [root@PC1 test]# ls a.txt (base) [root@PC1 test]# cat a.txt ## 测试数据 1 2 3 1 2 3 1 2 3 ## 将相同的序列转换为行 (base) [root@PC1 test]# awk '{if(NR %
阅读全文
摘要:001、脚本模板 #!/bin/bash #SBATCH -J TEST_NAME # 本次作业的名称 #SBATCH -p xhacnormala # 指定作业队列名 #SBATCH -o %j.result # %j将被作业号替代 #SBATCH -e %j.error # 错误日志输出 #SB
阅读全文
摘要:001、 (base) [root@PC1 test]# seq 3 > a.txt (base) [root@PC1 test]# cat a.txt ## 测试数据 1 2 3 (base) [root@PC1 test]# echo >> a.txt ## 末尾追加一个空行 (base) [r
阅读全文
摘要:001、basename命令可以获取末尾文件名和末尾目录名 (base) [root@PC1 home]# basename test2/a.txt a.txt (base) [root@PC1 home]# basename test2/dir01/ dir01 002、去除文件名后缀 (base
阅读全文
摘要:001、 (base) [root@PC1 home]# date +%s 1663810406 (base) [root@PC1 home]# date +%s 1663810410 date +%s //从 1970 年 1 月 1 日 00:00:00 UTC 到目前为止的秒数(时间戳) 参考
阅读全文
摘要:001、 [liujiaxin01@PC1 ~]$ whoami liujiaxin01 ## 非root用户 002、 将bash脚本中注释行后面的颜色设置为亮绿色 [liujiaxin01@PC1 ~]$ echo "highlight Comment ctermfg=green guifg=g
阅读全文
摘要:001、 文件名称 dog.slurm #!/bin/bash #SBATCH --job-name=dog # 本次作业的名称 #SBATCH -p xhacnormala # 等价于--partition,指定作业队列名 #SBATCH --output=%j.out # “%j”将被作业号替代
阅读全文
摘要:001、 (base) [liujiaxin01@PC1 ~]$ conda config --show channels channels: - defaults
阅读全文
摘要:001、生成自然序列 (base) root@ubuntu02:/home/test# seq 5 ## 默认从1开始递增 1 2 3 4 5 (base) root@ubuntu02:/home/test# seq 2 5 ## 指定起始点 2 3 4 5 002、生成序列的时候指定步长 (bas
阅读全文
摘要:-O选项表示将下载的内容进行重命名: [root@PC1 test]# ls [root@PC1 test]# wget -O xxxx http://mirrors.aliyun.com/repo/Centos-7.repo ## 下载内容保存为xxx --2022-09-19 09:42:39-
阅读全文
摘要:https://mirrors.aliyun.com/gnu/gcc/
阅读全文
摘要:001、自动获取IP dhclient 002、获取网关 route -n
阅读全文
摘要:001、利用net-tools工具下的 ifoconfig命令 root@ubuntu01:/home/software# ifconfig | head -n 3 ens32: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192
阅读全文