随笔分类 -  linux shell

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 78 下一页
摘要:001、 (base) [root@pc1 test]# ls (base) [root@pc1 test]# dd if=/dev/zero of=a.txt count=30 bs=1M ## 生成一个测试文件 30+0 records in 30+0 records out 31457280 阅读全文
posted @ 2023-11-25 17:49 小鲨鱼2018 阅读(85) 评论(0) 推荐(0)
摘要:mkdir -p选项保证在创建目录的时没有上一级目录情况下自动创建 001、不加 -p选项 (base) [root@pc1 test]# ls (base) [root@pc1 test]# mkdir test01/test02 ## 不加 -p, 创建两级目录,失败 mkdir: cannot 阅读全文
posted @ 2023-11-25 12:10 小鲨鱼2018 阅读(136) 评论(0) 推荐(0)
摘要:001、测试目录及文件 (base) [root@pc1 test01]# ls a.txt b.txt c.txt (base) [root@pc1 test01]# pwd /home/test/test01 002、同时复制a.txt 和 b.txt 到/home/test/test02目录中 阅读全文
posted @ 2023-11-25 12:05 小鲨鱼2018 阅读(658) 评论(0) 推荐(0)
摘要:001、方法1 (base) [root@pc1 test]# ls a.txt (base) [root@pc1 test]# cat a.txt ## 测试文本 aa aa aa bb bb cc cc cc cc ## 利用数组记录字符串重复的次数,借助printf格式化输出 (base) [ 阅读全文
posted @ 2023-11-20 20:37 小鲨鱼2018 阅读(91) 评论(0) 推荐(0)
摘要:001、Linux 中变量类型 01、系统变量:写入到系统配置文件中,启动终端则自动加载变量 02、shell变量:自定义临时变量 03、环境变量:通过使用export 作用与变量,使变量可以在进程间共享 env 可以显示所有的环境变量; set可以显示所有的变量; 测试如下: [root@pc1 阅读全文
posted @ 2023-11-17 13:11 小鲨鱼2018 阅读(355) 评论(0) 推荐(0)
摘要:001、测试(错误做法) (base) [root@pc1 test]# ls a.txt (base) [root@pc1 test]# cat a.txt ## 测试数据 1 2 3 4 5 6 7 8 9 10 (base) [root@pc1 test]# sed "s/5/$PWD/" a 阅读全文
posted @ 2023-11-17 12:51 小鲨鱼2018 阅读(443) 评论(0) 推荐(0)
摘要:001、示例 (base) [root@pc1 test]# echo -e "\033[47;30m xxxxx \033[0m" ## 47 表示背景色;30表示字体颜色 xxxxx 002、取消背景色 (base) [root@pc1 test]# echo -e "\033[30m xxxx 阅读全文
posted @ 2023-11-15 23:31 小鲨鱼2018 阅读(381) 评论(0) 推荐(0)
摘要:001、编译报错:fatal error: zlib.h: No such file or directory 002、查找改文件 (base) [root@pc1 test]# find / -name "zlib.h" ## 查找改文件, 存在 /root/anaconda3/pkgs/zlib 阅读全文
posted @ 2023-11-14 08:41 小鲨鱼2018 阅读(3497) 评论(0) 推荐(0)
摘要:设置打开文件数目限制是为了避免资源被耗尽,增加安全及稳定性。 001、查看软限制 (base) [root@pc1 software]# ulimit -Sn 1024 002、查看硬限制 (base) [root@pc1 software]# ulimit -Hn 4096 003、设置软限制 ( 阅读全文
posted @ 2023-11-12 22:44 小鲨鱼2018 阅读(676) 评论(0) 推荐(0)
摘要:source 命令的作用: a、刷新环境变量 b、执行shell脚本 c、加载函数(环境变量) d、从另外的shell脚本中读取变量 001、 刷新环境变量 (base) [root@pc1 software]# source ~/.bashrc ## 刷新环境变量 (base) [root@pc1 阅读全文
posted @ 2023-11-12 17:30 小鲨鱼2018 阅读(393) 评论(0) 推荐(0)
摘要:一个变量创建时,它不会自动的被在它之后创建的shell进程(子进程)所知;这时,可用export命令向后面的shell传递变量的值。export命令用于将shell变量输出为环境变量,或者将shell函数输出为环境变量。 参数: -f:代表[变量名称]中为函数名称。 -n:删除指定的变量;实际未删除 阅读全文
posted @ 2023-11-12 16:24 小鲨鱼2018 阅读(133) 评论(0) 推荐(0)
摘要:001、变异perl脚本警告如下:perl Makefile.PL INSTALL_BASE=/home/liujiaxin01/perl5 002、解决方法: yum install perl-core ## 安装perl核心 003、测试效果,以上警告消失 。 参考: 01、https://te 阅读全文
posted @ 2023-11-09 18:04 小鲨鱼2018 阅读(104) 评论(0) 推荐(0)
摘要:001、 rpm -qa | grep "package name"; 例如: [root@pc1 ~]# rpm -qa | grep "wget" ## 确认是否安装了wget命令 wget-1.14-18.el7_6.1.x86_64 [root@pc1 ~]# rpm -qa | grep 阅读全文
posted @ 2023-11-07 16:06 小鲨鱼2018 阅读(96) 评论(0) 推荐(0)
摘要:001、 centos7 中 (base) [root@pc1 test]# cat /etc/redhat-release ## 查看当前系统 CentOS Linux release 7.6.1810 (Core) (base) [root@pc1 test]# ldd --version ## 阅读全文
posted @ 2023-11-06 21:14 小鲨鱼2018 阅读(2454) 评论(0) 推荐(0)
摘要:linux 中shift命令应用与函数内部,调用一次,表示参数左移一位;$#表示shell参数的个数,调用shift一次, $#减少1. 分别处理每个参数,移出去的参数不再可用; 举例: 001、example 1 [root@pc1 test2]# ls a.sh [root@pc1 test2] 阅读全文
posted @ 2023-11-05 16:57 小鲨鱼2018 阅读(892) 评论(0) 推荐(0)
摘要:001、 方法1 [root@pc1 test]# ls test.sh [root@pc1 test]# cat test.sh ## 测试程序 #!/bin/bash function join_by { ## 定义函数 local IFS="$1" ## IFS定义输入分隔符, 其中local 阅读全文
posted @ 2023-11-05 16:35 小鲨鱼2018 阅读(292) 评论(0) 推荐(0)
摘要:linux 中 local为一个关键字,用于限制变量的作用范围(作用域),通常应用在函数的内部. 举例如下: 001、在函数内部定义变量, 不使用关键字local [root@pc1 test2]# ls a.sh [root@pc1 test2]# cat a.sh ## 测试函数 #/bin/b 阅读全文
posted @ 2023-11-05 16:06 小鲨鱼2018 阅读(2384) 评论(0) 推荐(0)
摘要:001、 创建数组 a、方法1 [root@pc1 test01]# ay1=(100 200 "abc" "xyz") ## 创建数组 b、方法2 [root@pc1 test01]# ay2[0]=100 [root@pc1 test01]# ay2[1]=200 [root@pc1 test0 阅读全文
posted @ 2023-11-05 10:40 小鲨鱼2018 阅读(707) 评论(0) 推荐(0)
摘要:001、 https://www.yzktw.com.cn/post/1163597.html 阅读全文
posted @ 2023-11-04 22:43 小鲨鱼2018 阅读(62) 评论(0) 推荐(0)
摘要:001、在执行perl Makefile.PL 命令时遇到如下报错: 002、解决方法: yum install perl-ExtUtils-MakeMaker 003、测试. 阅读全文
posted @ 2023-11-04 00:02 小鲨鱼2018 阅读(52) 评论(0) 推荐(0)

上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 78 下一页