Linux文件查找的命令

时间:2021-03-30 20:41:07   收藏:0   阅读:23

Linux命令

1.Linux文件相关的命令

1.1 find 查找文件或目录

语法:find [搜索范围][匹配条件]
参数说明
[root@localhost ~]# find / -name 123.txt
/ : 从根目录开始找
-name : 通过名字进行查找
123.txt :要查找的文件名字

1.2 grep 在文件内搜索字符串匹配的行输出

语法:grep [参数] 查找内容 源文件
参数:
[root@localhost qiancheng]# grep -c 1 123.txt 
3
----------------------------------------------
[root@localhost qiancheng]# grep -n 1 123.txt 
40:12121 12
41:21213132123132
108:1

1.3 which搜索命令所在目录以及别名信息

语法:which 命令
[root@localhost qiancheng]# which rm
alias rm=‘rm -i‘
        /usr/bin/rm
查找rm命名所在目录

原文:https://www.cnblogs.com/init-qiancheng/p/14597509.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!