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

Example Analysis of system input and output in linux

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

Share

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

Editor to share with you a sample analysis of the input and output of the system in linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1. Understand the input and output of the system

In a linux system, 1 indicates correct output and 2 indicates error output

two。 Symbols for managing input and output

(1) output redirection (output to the specified location)

> # # redirect correct output 2 > # redirect error output & > # redirect all output

Note: the following experiments should be completed among ordinary users

Find / etc/-name passwd > file1 # # directs correct output to file1 (error output that is not in the file will be displayed) find / etc/-name passwd 2 > file2 # # directs error output to file2 (correct output not put in file will be displayed) find / etc/-name passwd & > file3 # # directs all output to file3

File # # clear file (because the source file is overwritten when the'> 'symbol is output, > file overwrites the source file with blank space, which can be emptied)

(2) output append

> > # # append correct output to the last 2 > # # append error output to the end of the file & > > # # append all output to the end of the file

Note: append does not overwrite the contents of the source file

(3) input redirection

& 1 | tee file | wc-lumped # change the error output numbered 2 to the correct output numbered 1 and put it into the file file together and count the number

The above is all the contents of the article "sample Analysis of system input and output in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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