随笔分类 - linux shell
摘要:echo: 字体颜色 和 背景颜色。 常见的字体颜色:重置=0,黑色=30,红色=31,绿色=32,黄色=33,蓝色=34,紫色=35,天蓝色=36,白色=37。 常见的背景颜色:重置=0,黑色=40,红色=41,绿色=42,黄色=43,蓝色=44,紫色=45,天蓝色=46,白色=47。 字体控制选
阅读全文
摘要:001、输出字符串 [root@PC1 test01]# printf "abcd\n" abcd [root@PC1 test01]# printf "%s\n" "abcd" ## 输出字符串 abcd 002、指定宽度 [root@PC1 test01]# printf "%s\n" "abc
阅读全文
摘要:001、测试 [root@PC1 test01]# printf "abcd\n" ## 输出abcd并换行 abcd [root@PC1 test01]# printf "ab!cd\n" ## 不能正常的输出感叹号 -bash: !cd\n": event not found [root@PC1
阅读全文
摘要:linux 中echo命令用于各种形式的字符串输出。 转义字符 含义\b 删除前一个字符\n 换行\t 水平制表符(tab)\v 垂直制表符(tab)\c \c后面的字符将不会输出,输出完毕后也不会换行\r 光标移动到首行,换行\f 换行,光标停在原处\e 删除后一个字符\ 输出\\0nnn 输出八
阅读全文
摘要:001、方法1 [root@PC1 test01]# echo 'abc!' ## 使用单引号 abc! 002、方法2 [root@PC1 test01]# echo "abc! " ## 双引号, 感叹后后面加空格 abc! 003、方法3 [root@PC1 test01]# echo abc
阅读全文
摘要:001、查看当前用户所在的用户组 [root@PC1 test01]# whoami ## 当前用户 root [root@PC1 test01]# groups ## 当前用户所在的用户组 root 002、查看指定用户所属的用户组 [root@PC1 test01]# groups liujia
阅读全文
摘要:001、下载安装包 官网:https://cmake.org/ 002、解压安装包 tar -xzvf cmake-3.27.0-rc2-linux-x86_64.tar.gz cd cmake-3.27.0-rc2-linux-x86_64/bin ls 003、测试命令及版本 (base) [r
阅读全文
摘要:EPEL (Extra Packages for Enterprise Linux) 是一个由 Fedora 社区志愿者维护的软件包仓库,为 Red Hat Enterprise Linux (RHEL)、CentOS 和 Scientific Linux 等企业级Linux发行版提供额外的软件包。
阅读全文
摘要:001、查看防火墙状态 [root@PC1 test05]# systemctl status firewalld.service 002、关闭防火墙 [root@PC1 test05]# systemctl stop firewalld.service ## 关闭防火墙 [root@PC1 tes
阅读全文
摘要:001、 [root@PC1 test2]# cat record.sh #!/bin/bash while : do du -sh ./ sleep 2 ## 每隔2秒输出指定目录的大小 done
阅读全文
摘要:001、当变量为空时,为变量赋值 [root@PC1 test2]# var bash: var: command not found... [root@PC1 test2]# echo $var [root@PC1 test2]# var=${var:-123456} ## 变量为空时,将变量的值
阅读全文
摘要:001、关闭、开启回显功能 [root@PC1 test2]# seq 3 1 2 3 [root@PC1 test2]# stty -echo ## 关闭回显功能,关闭后在终端输入内容将不再显示 [root@PC1 test2]# 1 2 3, [root@PC1 test2]# [root@PC
阅读全文
摘要:001、 [root@PC1 test04]# ls a.txt test.py [root@PC1 test04]# 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
阅读全文
摘要:001、 [root@PC1 test03]# a=100 [root@PC1 test03]# echo $a 100 [root@PC1 test03]# echo $a+500 100+500 [root@PC1 test03]# echo $[a+500] ## 中括号可以实现变量运算 60
阅读全文
摘要:001、 [root@PC1 test03]# ls a.txt [root@PC1 test03]# cat a.txt ## 测试数据 bookbookbookbook jjjj name=jack uuuuuuu 127.0.0.1 bookbook77 xxxxx.com eeebookbo
阅读全文
摘要:001、删除文件的第一列 [root@PC1 test03]# ls a.txt [root@PC1 test03]# 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 te
阅读全文
摘要:r选项的作用表示在文件中匹配B, 然后读入a.txt的内容, 添加到B的后面 001、 (base) [root@PC1 test2]# ls a.txt b.txt (base) [root@PC1 test2]# cat a.txt 1 2 3 4 5 (base) [root@PC1 test
阅读全文
摘要:001、 [root@PC1 test04]# ls a.txt [root@PC1 test04]# cat a.txt ## 测试数据 3333 gene 9999 kkkk gene 7777 8888 gene gene 0000 6666 ## 输出匹配字符及其下一行 [root@PC1
阅读全文
摘要:001、 [root@PC1 test04]# ls a.txt [root@PC1 test04]# cat a.txt ## 测试数据 3333 gene 9999 kkkk gene 7777 8888 gene 0000 6666 [root@PC1 test04]# sed -n '/ge
阅读全文
摘要:001、 [root@PC1 test04]# ls a.txt [root@PC1 test04]# cat a.txt ## 测试数据 3333 gene 9999 kkkk gene 7777 8888 gene 0000 6666 [root@PC1 test04]# awk '$1 ==
阅读全文