随笔分类 -  linux shell

上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 78 下一页
摘要:1、问题,下载压缩文件后,不能显示压缩文件的颜色(红色),执行source ./bashrc后系统可以显示 问题如下,因此推测是系统启动时没有自动执行source ./bashrc 2、解决方法,在~/.bash_profile增加如下语句: if [ -f ~/.bashrc ]; then . 阅读全文
posted @ 2021-12-24 22:40 小鲨鱼2018 阅读(2056) 评论(0) 推荐(1)
摘要:1、find可以实现对指定文件大小的查找 root@PC1:/home/test2# ls b.ped outcome.map outcome.ped root@PC1:/home/test2# ll -h total 1.4G -rw-r--r-- 1 root root 1.3G 12月 22 阅读全文
posted @ 2021-12-22 23:01 小鲨鱼2018 阅读(1794) 评论(0) 推荐(0)
摘要:1、 root@PC1:/home/test2# ls b.ped outcome.map outcome.ped xx root@PC1:/home/test2# du -ah ## 显示每一个文件的大小 4.0K ./xx 1.3M ./outcome.map 1.3G ./b.ped 158M 阅读全文
posted @ 2021-12-22 22:43 小鲨鱼2018 阅读(553) 评论(0) 推荐(0)
摘要:1、croc安装 方法1: curl https://getcroc.schollz.com | bash 方法2(ubuntu): gdebi croc_8.3.2_Linux-64bit.deb ## (需要提前下载好安装包) https://github.com/schollz/croc/re 阅读全文
posted @ 2021-12-22 22:06 小鲨鱼2018 阅读(586) 评论(0) 推荐(0)
摘要:1、测试主机PC1、PC2 root@PC1:/home/test2# ls root@PC1:/home/test2# hostname PC1 root@PC1:/home/test2# ifconfig | head -n 3 ens32: flags=4163<UP,BROADCAST,RU 阅读全文
posted @ 2021-12-22 21:18 小鲨鱼2018 阅读(175) 评论(0) 推荐(0)
摘要:1、测试数据 root@PC1:/home/test# ls outcome.ped root@PC1:/home/test# cat outcome.ped ## 测试数据, 将每隔一个空格的两列并排为一列 G G C C G G G G G A A A G G G C G G G C G G G 阅读全文
posted @ 2021-12-19 22:34 小鲨鱼2018 阅读(191) 评论(0) 推荐(0)
摘要:1、删除test.txt末尾的单个或者多个空格或者制表符 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt ## 测试数据 2 3 4 a 3 d d w e z v e z c g z v b root@PC1:/ 阅读全文
posted @ 2021-12-16 22:40 小鲨鱼2018 阅读(1651) 评论(0) 推荐(0)
摘要:1、测试数据,依据列数筛选数据 root@PC1:/home/test# ls test.txt root@PC1:/home/test# cat test.txt ## 测试数据 2 3 4 3 d a 3 d d w e f z v e z c g k e q z v b d root@PC1: 阅读全文
posted @ 2021-12-16 22:34 小鲨鱼2018 阅读(897) 评论(0) 推荐(0)
摘要:1、问题 ubuntu中解压rar文件, 如下: root@PC1:/home/test2# ls test.rar root@PC1:/home/test2# unrar e test.rar -bash: /usr/bin/unrar: No such file or directory 2、解 阅读全文
posted @ 2021-12-16 21:52 小鲨鱼2018 阅读(2607) 评论(0) 推荐(0)
摘要:sort命令 -g选项忽略字母 1、测试数据 root@PC1:/home/test# ls a.txt root@PC1:/home/test# cat a.txt name gender score ddd 2 8 aa 1 87 ff 2 3 ss 1 23 root@PC1:/home/te 阅读全文
posted @ 2021-12-15 23:28 小鲨鱼2018 阅读(299) 评论(0) 推荐(0)
摘要:1、测试数据 root@PC1:/home/test/test# ls test.txt root@PC1:/home/test/test# cat test.txt ## 实现将每行最后一个e替换为xxx e r e y e u e e e g e 3 h r 1 3 e g e y e e s 阅读全文
posted @ 2021-12-15 00:23 小鲨鱼2018 阅读(2225) 评论(0) 推荐(0)
摘要:1、创建测试数据 root@PC1:/home/test/test# seq -f %02g 40 | awk '{if(NR % 4 == 0) {print $0} else {printf("%s ", $0)}}' ## 利用seq命令产生连续数字,然后利用awk分配行 01 02 03 0 阅读全文
posted @ 2021-12-15 00:01 小鲨鱼2018 阅读(228) 评论(0) 推荐(0)
摘要:linux shell中统计文本中指定单词出现的次数 1、测试数据, 统计 a.txt中e出现的总次数 root@PC1:/home/test/test# cat a.txt e r e y e u e e e g e 3 h r 1 3 e g e y e e s e e e e e 2、awk实 阅读全文
posted @ 2021-12-14 22:13 小鲨鱼2018 阅读(1351) 评论(0) 推荐(0)
摘要:1、测试数据如下, 实现将每行的第3个e及其以后的e替换为g root@PC1:/home/test/test# cat a.txt e r e y e u e e e g e 3 h r 1 3 e g e y e e s e e e e e 3、 root@PC1:/home/test/test 阅读全文
posted @ 2021-12-14 21:59 小鲨鱼2018 阅读(265) 评论(0) 推荐(0)
摘要:1、最后一行末尾追加字符 root@ubuntu01:/home/test2# cat num.txt 1 1 1 2 root@ubuntu01:/home/test2# sed '$ s/$/ final/' num.txt ## 使用sed实现, 第一个$限制最后一行, 第二个$指出替换的位置 阅读全文
posted @ 2021-12-12 21:47 小鲨鱼2018 阅读(5391) 评论(2) 推荐(0)
摘要:1、将1至4各重复3次, shell双循环实现 root@ubuntu01:/home/test2# ls root@ubuntu01:/home/test2# for i in `seq 4`; do for j in `seq 3`; do echo $i >> num.txt; done; d 阅读全文
posted @ 2021-12-11 23:12 小鲨鱼2018 阅读(225) 评论(0) 推荐(0)
摘要:1、测试数据 root@ubuntu01:/home/test2# cat test.txt ## 实现将每一行按照第二行数字指定的行数重复 1 3 e3rt idf 2 2 32 ffj 3 5 cc kkk 4 4 wf 34 2、while + for双循环实现 root@ubuntu01:/ 阅读全文
posted @ 2021-12-11 22:53 小鲨鱼2018 阅读(804) 评论(0) 推荐(0)
摘要:1、问题 apt install 慢, 如下: root@ubuntu01:/home/test# apt install git 2、解决方法 root@ubuntu01:/home/test# cd /etc/apt/ root@ubuntu01:/etc/apt# ls apt.conf.d 阅读全文
posted @ 2021-12-10 22:10 小鲨鱼2018 阅读(2120) 评论(0) 推荐(1)
摘要:问题 1、apt remove net-tools Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. 2、结束这个占用的进程 root@ubuntu01:~# kill -9 5937 3、测试 root@ 阅读全文
posted @ 2021-12-10 21:59 小鲨鱼2018 阅读(2051) 评论(0) 推荐(0)
摘要:1、查看内核 2、安装open-vm-tools sudo apt-get install open-vm-tools sudo apt-get install open-vm-tools-desktop 3、重启即可 reboot reboot 阅读全文
posted @ 2021-12-08 21:52 小鲨鱼2018 阅读(133) 评论(0) 推荐(0)

上一页 1 ··· 55 56 57 58 59 60 61 62 63 ··· 78 下一页