linux命令嵌套实例(五)

来源:互联网 发布:nginx http2 不用TLS 编辑:程序博客网 时间:2024/06/05 15:47

8、用“>”小于号来重定向、存储信息、覆盖原文件信息。例如:

A用“>”小于号来重定向:

[root@localhost apache-tomcat]# cd .. > cd .. >cd ..
[root@localhost 桌面]#

B用“>”小于号来重存储信息:

 cat apache-tomcat/logs/catalina.2017-08-22.log | grep Starting > start0822

C用“>”小于号来重覆盖原文件信息:

cat start2
信息: Starting service Catalina
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
信息: Starting ProtocolHandler ["http-bio-8080"]
信息: Starting ProtocolHandler ["ajp-bio-8009"]
信息: Starting service Catalina
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
信息: Starting ProtocolHandler ["http-bio-8080"]
信息: Starting ProtocolHandler ["ajp-bio-8009"]
[root@localhost 桌面]# cat start1 > start2
[root@localhost 桌面]# cat start2
信息: Starting service Catalina
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
信息: Starting ProtocolHandler ["http-bio-8080"]
信息: Starting ProtocolHandler ["ajp-bio-8009"]

注意:要追加信息要用">>"而不是">"。例如:

cat start1 >> start2
[root@localhost 桌面]# cat start2
信息: Starting service Catalina
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
信息: Starting ProtocolHandler ["http-bio-8080"]
信息: Starting ProtocolHandler ["ajp-bio-8009"]
信息: Starting service Catalina
信息: Starting Servlet Engine: Apache Tomcat/7.0.79
信息: Starting ProtocolHandler ["http-bio-8080"]
信息: Starting ProtocolHandler ["ajp-bio-8009"]



原创粉丝点击