随笔分类 - linux shell
摘要:001、发行版信息 [root@pc1 test]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) ## centos7.6 002、当前gcc版本 [root@pc1 test]# gcc --version gcc (G
阅读全文
摘要:001、 (base) [root@pc1 test02]# ls a.txt (base) [root@pc1 test02]# cat a.txt ## 测试文件 use File::Basename; use File::Spec; use List::Util 'none'; use "Ca
阅读全文
摘要:001、报错如下: 002、解决方法 在3694行 的末尾加上 --no-discard-stderr sed -i '3694 s/$/ --no-discard-stderr /' Makefile ## 在3694末尾添加上--no-discard-stderr, -i表示在原文中添加 003
阅读全文
摘要:001、打包只指定目录 [root@pc1 test]# ls a.txt b.map c.ped dir1 [root@pc1 test]# ls dir1/ [root@pc1 test]# tar -cf ./dir1/xx.tar a.txt b.map c.ped ## 打包至指定的目录
阅读全文
摘要:001、 [root@pc1 test]# for i in ab8 ab23 ab98; do echo $i; done ## 直接迭代 ab8 ab23 ab98 [root@pc1 test]# for i in ab{8,23,98}; do echo $i; done ## 可以写成如下
阅读全文
摘要:001、 [root@pc1 test]# ls ## 两个测试文件 a.txt b.txt [root@pc1 test]# cat a.txt 01 02 03 04 05 06 07 08 09 10 11 12 [root@pc1 test]# cat b.txt a b c [root@p
阅读全文
摘要:001、 linux 中 strings命令 主要是在对象文件或者二进制文件中查找可打印的字符串。 002、举例 (base) [b20223040323@admin1 ~]$ strings /bin/ls | head /lib64/ld-linux-x86-64.so.2 libselinux
阅读全文
摘要:001、python程序报错如下: 002、问题分析 a、调用的是python程序 b、libstdc++.so.6是c++标准库 执行python程序时,需要调用c++标准库,libstdc++.so.6(lib = glib, 6 表示第6版),版本不匹配报错,无法找到:GLIBCXX_3.4.
阅读全文
摘要:001、 Ldd: linux 系统中的一个测试工具,用于查看可执行文件或者共享库文件所依赖的动态链接库. 主要用于协助分析和解决程序运行时的依赖关系。 动态链接库? 002、举例 ldd 003、解决依赖关系 a、安装相应的软件包来获取缺失的动态链接库 比如红帽系列使用yum命令、ubuntu中使
阅读全文
摘要:001、 c运行库. linux 系统中最低成的API(应用程序接口), 几乎其它任何运行库都会依赖与glibc. glibc是GNU发布的libc库,即c运行库。glibc是linux系统中最底层的api,几乎其它任何运行库都会依赖于glibc。glibc除了封装linux操作系统所提供的系统服务
阅读全文
摘要:001、按照原始顺序输出 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试数据 a 76 b 78 a 100 c 222 b 7777 b 8888 a 9999 b 3333 d 1111 e 7777777 e 999
阅读全文
摘要:001、 输出第一列中没有重复的文本 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试数据 a 76 b 78 a 100 c 222 b 7777 b 3333 d 1111 ## 先把文本叠加一次, 然后引入文本行数变量
阅读全文
摘要:001、 [root@pc1 test02]# ls a.txt [root@pc1 test02]# cat a.txt ## 测试数据 a 76 b 78 a 100 c 222 b 7777 b 3333 d 1111 ## 输出所有的重复 ## 对重复去重 ## 将重复叠加至表头 ## 输出
阅读全文
摘要:001\ [root@pc1 test01]# ls [root@pc1 test01]# seq 3 > a.txt ## 测试文件 [root@pc1 test01]# ls a.txt [root@pc1 test01]# cat a.txt 1 2 3 [root@pc1 test01]#
阅读全文
摘要:001、 (base) [b20223040323@admin1 NTlibrary]$ find nt.01* | xargs du -sch ## 查找一类文件,并统计总的大小,-c表示总计 76M nt.01.nhd 1.7M nt.01.nhi 797M nt.01.nhr 50M nt.0
阅读全文
摘要:系统:centos7.6 1810 001、下载tmux工具 [root@pc1 ~]# tmux bash: tmux: command not found... [root@pc1 ~]# yum install tmux -y ## 安装命令 002、启动 tmux 功能 在终端直接输入 tm
阅读全文
摘要:001、方法1 expr [root@pc1 test]# expr 50 + 40 90 002、方法2 bc [root@pc1 test]# echo 50 + 40 | bc 90 003、方法3 awk [root@pc1 test]# awk 'BEGIN{print 50 + 40}'
阅读全文
摘要:001、 [root@pc1 test]# cat test.sh ## 函数脚本 #!/bin/bash function db1 ## function关键字来定义函数,db1是函数名 { read -p "请输入:" value return $[$value *2] ## return返回函
阅读全文
摘要:001、 awk + 数组实现 [root@pc1 test2]# ls a.txt [root@pc1 test2]# cat a.txt ## 测试数据 a b b a b c f f b a [root@pc1 test2]# awk '{ay[$0]++; print ay[$0], $0}
阅读全文
摘要:001、间隔2 [root@pc1 test1]# ls a.txt [root@pc1 test1]# cat a.txt ## 测试数据 1 2 3 4 5 6 7 8 9 10 [root@pc1 test1]# awk '{if(NR % 2 == 1) {count++}; if(NR %
阅读全文

浙公网安备 33010602011771号