Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed instructions on the use of Linux input and output redirection

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

1. Linux standard input and output

Linux standard input and output devices are mainly keyboards and monitors, as shown in the following table.

Note: one of the > means: overwrite the contents of the original file; if the file does not exist, create the file; if the file exists, empty it; usually when we back up and clean up the log file

Two > that is > > means: after the content in the original file is appended; if the file does not exist, the file is created; if the file exists, the new content is appended to the end of that file, and the original content in the file is not affected.

2. Linux output redirection

Output redirection: change the input source and output location of the program.

The main applicable methods are shown in the following table:

Output redirection type symbol function standard output redirection command > file overwrite, output the correct output of the command to the specified file or device command > > file by append, output the correct output of the command to the specified file or device standard error output redirection error command 2 > file overwrite Output the error output of the command to the specified file or device in the error command 2 > > file by append, output the error output of the command to the specified file or device and save the command > file 2 > & 1 to overwrite, save the correct output and error output of the command to the same file command > file 2 > & 1 as an append Save the correct output and error output of the command to the same file. The command & > file overwrites the correct output and error output of the command to the same file. Save the correct output and error output of the command to the same file. Save the correct output and error output of the command to the same file. Command > File 12 > File 2 as an append Save the correct output of the command in file 1 Save the error output of the command to file 2 in override mode

3. Linux input redirection

Enter redirect type symbol function standard input command

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report