Linux文件查找的命令

时间:2021-03-31 12:14:17   收藏:0   阅读:0

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命名所在目录
评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!