按文件的大小进行查找
cpp
find / usr -size +100M
在home路径下创建txt文件
cpp
touch test.txt
查看test.txt文件中的内容:
cpp
cat test.txt
通过指令pwd可以查看当前所处路径。
切换超级用户的指令:
cpp
su - root
离开时可以使用指令:exit
grep指令可以,从文件中通过关键字过滤文件行。
cpp
grep -n "World" test.txt
效果:
2:printf("hello World");
管道符:|
含义:将管道符左边命令的结果,作为右边命令的输入。
cpp
cat test.txt | grep hello | grep Linux
统计文件中带hello的有几行:
cpp
cat test.txt | grep hello | wc -l
统计文件中带world关键字的结果有多少个单词:
cpp
cat test.txt | grep World | wc -w
echo
cpp
echo "hello,Linux"
输出
hello,Linux
cpp
echo `pwd`
/home/lzy
使用echo 将当前工作目录写入work.txt
cpp
echo `pwd` > work.txt
使用echo 将Linux写入work.txt,通过tail命令持续跟踪文件内容更改。
cpp
echo "Linux" > work.txt
tail -f work.txt
![](https://img-blog.csdnimg.cn/direct/547ff867da12485bb46e3b3b0997d7d5.png)
![](https://img-blog.csdnimg.cn/direct/ad63ad0628e2469e8b5b965901eed0e5.png)
![](https://img-blog.csdnimg.cn/direct/8745daa174da4f0696bf878d68917e8a.png)
![](https://img-blog.csdnimg.cn/direct/481d316bdfdf4581a2be19ddf6a0fdb0.png)
cpp
mv work.txt test/
将work.txt移动到test文件夹。
cpp
mkdir test
创建test文件夹
cpp
chmod u=rwx,g=r,o=w test.txt
修改test.txt的权限。
cpp
mv code.c code
将code.c代码移动到code文件夹
cpp
ls test
查看test文件夹中的内容。
![](https://img-blog.csdnimg.cn/direct/d2de4e1f1c2344a3bb812535d3c2731b.png)
![](https://img-blog.csdnimg.cn/direct/895fa0e289154c9fbb46763988c806a0.png)
cpp
ls -l test
查看test文件夹中的内容
![](https://img-blog.csdnimg.cn/direct/a2049c87c270423781af33bff5a0b7f5.png)