" means overwriting the content of the source file (the date of the file will also be automatically updated), ">>" means appending the content (a new line will start, and the date of the file will also be updated). automatically updated).">
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
2. Execute the command curl 'xxx' and save the return result in log.log
[root@gx-solr1 ~]# curl 'http://192.168.0.110:8983/solr/scan_detail/admin/file?_=1544066402749&contentType=text/plain;charset=utf-8&file=managed-schema&wt=json' > log.log
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
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!