linux的重定向与xshell原理

一、重定向

1.输出重定向:>

写入指定文件

[root@VM-8-8-centos lesson5]#  cat file.txt
[root@VM-8-8-centos lesson5]# echo "hello world" > file.txt
[root@VM-8-8-centos lesson5]#  cat file.txt
hello world
[root@VM-8-8-centos lesson5]# cat file.txt > test.c
[root@VM-8-8-centos lesson5]#  cat test.c
hello world


2.追加重定向 :>>

[root@VM-8-8-centos lesson5]#  echo "you can see you" > file.txt
[root@VM-8-8-centos lesson5]#  cat file.txt
you can see you
[root@VM-8-8-centos lesson5]# echo "you can see me" >> file.txt
[root@VM-8-8-centos lesson5]#  cat file.txt
you can see you
you can see me
[root@VM-8-8-centos lesson5]#  echo "you can see me" >> file.txt
[root@VM-8-8-centos lesson5]# cat file.txt
you can see you
you can see me
you can see me


把file.txt文件的内容 you can see me 打印后,
使用 >> 发现会在文件结尾 追加内容。

3.输入重定向:<



```c

[root@VM-8-8-centos lesson5]# cat < file.txt
you can see you
you can see me
you can see me
[root@VM-8-8-centos lesson5]#  cat file.txt
you can see you
you can see me
you can see me


cat < file.txt 与 cat file.txt等价
cat < file.txt :从fille.txt文件中读取数据

二 、xshell命令及原理

在这里插入图片描述

用户并不是直接访问操作系统,而是通过外壳程序
外壳程序通过指令的方式收到,外壳程序把收到的指令传递给操作系统 操作系统进行处理,执行完后 再通过shell 返回给用户

  • 9
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值