Output REDIRECT symbol:
: Overwrite output
>>: Append output
SET-C: Prohibit overwrite redirection of existing files
Force overwrite output after prohibit setting, use >|
Set +c: Turn off the above features
Standard output
Override mode standard output redirection [[email protected] basic]# ls /var > a.txt[[email protected]  BASIC]# CAT A.TXT ACCOUNTCACHECRASHCVSDB Append mode standard output REDIRECT [[email protected] basic]# ll /home >> a.txt[[email protected] basic]# cat a.txt accountcachecrashcvsdbemptytotal 16948-rw-r--r-- 1 root root 5484681 dec 8 12:24 4.1.0. tar.gzdrwxr-xr-x 2 root root     4096 DEC 20 10:55 BASICDRWX------ 2 chenchao chenchao 4096 Dec 14 17:34 chenchaodrwxrwxr-x 8 root root 4096 dec 8 12:25 ipython-4.1.0drwxr-xr-x. 2 root root       4096 DEC  7 19:05 LOGSDRWX------. 2 root root 16384 dec 7 19:00 lost+found
Standard error Output
Override mode standard error output redirect [[email protected] basic]# ll/var12 2> b.txt[[email protected] basic]# cat b.txt ls:cannot access/var12 : No such file or directory Append mode standard error output redirect [[email protected] basic]# ll/var12 2>> b.txt[[email protected] basic]# cat B.txt ls:cannot access/var12:no Such file or directoryls:cannot access/var12:no such file or directory
Standard output and standard error output simultaneous redirection
[Email protected] basic]# ll/var12 &> b.txt [[email protected] basic]# ll/var &> b.txt [email protecte D] basic]# cat b.txt Total 76drwxr-xr-x. 2 root root 4096 Dec 03:43 accountdrwxr-xr-x. Root root 4096 Dec 7 19:04 cachedrwxr-xr-x. 2 root root 4096 Nov 23:19 crashdrwxr-xr-x. 2 root root 4096 Nov cvsdrwxr-xr-x. 3 root root 4096 Dec 7 19:04 DB
i.e. output to screen and save to file
[[email protected] basic]# echo "Hello word" | Tee C.txthello word[[email protected] basic]# cat c.txt Hello Word
This article from "Liang Childe" blog, please be sure to keep this source http://iyull.blog.51cto.com/4664834/1884189
Linux Base--i/o Redirection