linux中查找文件或者文件中的内容
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash

·
经常会遇到在Linux中查找文件的位置或者已知某个结构体或者类的名字想知道里面的具体内容,下面将对其进行总结
- 查找文件
- 如果知道文件的具体名称的话,比如hello.c,使用locate hello.c就可以找到文件的具体位置
- 如果不知道文件的名称,只知道hell这几个字符,可以使用find进行模糊查询
- 如果知道文件的大致位置比如/usr,可以写成 find /usr -name hell*
- 如果不知道位置,那就从/开始找,写成 find / -name hell*
- 查找文件中的内容
- 对于特定找头文件,一般都在/usr/src或者/usr/include下面,可以写成 grep "typedef pthread_attr_t" /usr/include -R -n -R表示递归查找 -n表示查找出来之后显示行号
- 对于知道某个具体文件,查找里面的内容,比如我想查看CPU的情况,可以写cat /proc/stat | grep "cpu"即可




A beautiful web dashboard for Linux
最近提交(Master分支:17 天前 )
186a802e
added ecosystem file for PM2 5 年前
5def40a3
Add host customization support for the NodeJS version 5 年前
更多推荐
所有评论(0)