linux中的各种指令

按文件的大小进行查找

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
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文件夹中的内容。

cpp 复制代码
ls -l test

查看test文件夹中的内容

相关推荐
Mr_Orangechen10 分钟前
Linux 下使用 VS Code 远程 GDB 调试 ARM 程序
linux·运维·arm开发
撰卢27 分钟前
【个人笔记】负载均衡
运维·笔记·负载均衡
Shartin1 小时前
Can201-Introduction to Networking: Application Layer应用层
服务器·开发语言·php
lilian1291 小时前
linux系统mysql性能优化
linux·运维·mysql
共享家95272 小时前
linux_线程概念
linux·开发语言·jvm
apihz2 小时前
VM虚拟机全版本网盘+免费本地网络穿透端口映射实时同步动态家庭IP教程
android·服务器·开发语言·网络·数据库·网络协议·tcp/ip
乌云暮年2 小时前
Linux常用命令
linux·服务器·ssh·php
weixin_516023072 小时前
Geant4 安装---Ubuntu
linux·运维·ubuntu
稀液蟹-plus2 小时前
zynq-PS篇——bperez77中DMA驱动注意事项
linux·fpga
wanhengidc2 小时前
企业选择大带宽服务器租用的原因有哪些?
运维·服务器