In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "sample analysis of Bash pipes and redirects in linux", which is easy to understand and well-organized. I hope it can help you solve your doubts. Let me lead you to study and learn about "sample analysis of Bash pipes and redirects in linux".
Piping and redirection
The standard input devices of Bash are keyboards, mice, handwriting boards and other devices, and the standard output is the display. Generally, we enter commands through the keyboard and execute them, and the system displays the returned information on the screen. By default, whether it is correct or wrong, the information will be output to the display. The file descriptor for standard input is 0, for standard output is 1, and for error output is 2. But sometimes we need to change the standard input and output mode. In Linux, we can use redirects (, |) to redefine input and output.
The pipe allows us to connect multiple commands together, and its function is to redirect the standard output of one command to the next command as standard input to that command. For example, if you use the ifconfig eth0 | grep 'inet addr' command to filter lines containing IP addresses, ifconfig itself will output a large amount of information about the network interface. Because the pipe symbol (|) is used here, all the output of the ifconfig command will be used as the input of the grep command, and finally the lines containing IP addresses will be filtered.
The standard output information is output to the monitor, and sometimes you may not need the output information, or you may not need to see it on the screen for the time being; in addition, the input information is usually entered through the keyboard, and sometimes you may want to be able to read the input information from the file. Output redirection can use the > or > > symbol, use > to import the output to a file, create the file if the file does not exist, and overwrite the contents of the file if the file already exists; and use > > to append the output to the file; in addition, the redirection of the corresponding error message needs to be implemented using the 2 > or 2 > > symbol. Input redirection can be used
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.