In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1. Output redirection: standard output: standard error output (2): error information generated during the execution of the command is also output to the terminal standard input: refers to input 2 from the keyboard, standard output redirection (1) function: redirect the information that would have been displayed on the standard output (terminal) to a file if the file does not exist The file is created automatically. Format: > or > > implementation: 1 > and 1 >: empty and rewrite the contents of the target file > >: append after the original content (if the file does not exist Automatically create the file) [root@7 home] # date +% F-%H:%M:%S > a.txt [root@7 home] # cat a.txt 2019-08-14-16:59:04 [root@7 home] # date +% F-%H:%M:%S > > a.txt [root@7 home] # date +% F-%H:%M:%S > > a.txt [root@7 home] # Date +% F-%H:%M:%S > > a.txt [root@7 home] # cat a.txt 2019-08-14-16:59:04 2019-08-14-16:59:28 2019-08-14-16:59:29 2019-08-14-16 purl 593, Error output redirection format: 2 > or 2 > # Standard output > log.txt ls: cannot access / tmpa/: No such file or directory # 2 means to redirect the error message The correct output is still on the terminal [root@7 home] # ls / home/ / tmpa/ 2 > > log.txt / home/: an a.txt log.txt newbook2 example: save the correct information to the file ok.txt file Save the error message to the error.txt file [root@7 home] # ls / home/ / tmpa/ > ok.txt 2 > error.txt [root@7 home] # ls an a.txt error.txt log.txt newbook2 ok.txt [root@7 home] # cat ok.txt / home/: an a.txt error.txt log.txt newbook2 ok.txt [root@7 home] # cat error.txt ls: cannot access / tmpa/: No such file or directory4, Tee command function: output information to the terminal and direct to the file option:-a: the new result is appended to the end of the file (by default, the new content overwrites the old content) [root@7 home] # echo "123" | tee 2.txt [root@7 home] # cat 2.txt 123 [root@7 home] # echo" 321 "| tee 2.txt 321 [root@7 home] # cat 2. Txt example: record the file name under / etc in the file log.txt [root@7 home] # ls / etc > log.txt example: put a. The first three lines of txt are displayed on the desktop Also save [root@7 home] # head-n3 a.txt in the file info.txt | tee info.txt 2019-08-14-16:59:04 2019-08-14-16:59:28 2019-08-14-16:59:29 [root@7 home] # cat info.txt 2019-08-14-16:59:04 2019-08-14-16:59:28 2019-08-14-16:59:29 example: Copy a.txt content to b.txt [root@7 home] # cat a.txt > > b.txt
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.