Home > Operation and Maintenance > Linux Operation and Maintenance > What is the difference between '<' and '<<' in linux

What is the difference between '<' and '<<' in linux

王林
Release: 2020-07-20 17:31:07
forward
6236 people have browsed it

What is the difference between '<' and '<<' in linux

Difference:

In Linux, > means overwriting the original file content (the date of the file will also be automatically updated), >> means appending the content (it will start a new file) line, the date of the file will also be updated automatically).

(Recommended tutorial: linux tutorial)

Example:

1. Save the results of the history command execution to the history.log file

[root@gxzs-solr1 ~]# history > history.log      (history.log 文件 会自动生成)
[root@gxzs-solr1 ~]# cat history.log
Copy after login

2. Execute the command curl 'xxx' and save the return result in log.log

[root@gx-solr1 ~]# curl &#39;http://192.168.0.110:8983/solr/scan_detail/admin/file?_=1544066402749&contentType=text/plain;charset=utf-8&file=managed-schema&wt=json&#39; > log.log
Copy after login

3. Execute the command cat /etc/hosts and save the return result in hosts.log中

[root@slave1 ~]# cat /etc/hosts > hosts.log
[root@slave1 ~]# more hosts.log 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
Copy after login

Note: When using > , when executing a command, a new file following > will be generated each time, replacing the previously generated file (the file creation time will also change accordingly).

The above is the detailed content of What is the difference between '<' and '<<' in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template