In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
/ dev/sda2 hard disk / dev/shm memory
1. Understand the input and output in the system
Instructions in shell programs-> cpu to generate operation results-> character devices
Input the instruction in the shell program, send it to cpu to calculate the result, and then send it to the character device to display.
two。 Symbols for managing input and output
Redirect correct output
2 >: reimagine error output
& >: redirect all output
Note:
Redirection overwrites the contents of the original file
Example: (to take a screenshot)
"Note: the following experiments must be completed under student users"
Find / etc/-name passwd > file directs the correct input to file
Find / etc/-name passwd 2 > file.err misdirected input to file.err
Find / etc/-name passwd & > file.all directs all inputs to file.all
Clear a file command: > file name
3. Pipeline action
1.wc command
Using the wc instruction, we can calculate the number of Byte, words, or columns of a file. If the file name is not specified, or if the file name is given as "-", the wc instruction will read data from the standard input device.
-c displays bytes or chars displays only bytes
-l displays the number of rows
-w shows the number of words
$wc file name: displays the number of lines, words and bytes of the file
$wc multiple files: count the information of three files
3.2. The role of pipes
The function of the "|" pipe is to change the output of the previous command into the input of the latter command.
So ls / bin/ | wc-l is 1588 but ls / bin/ | wc-l is 1 because there is only one line in 1588.
Note: the pipeline only allows the correct output to pass through
The input through the pipe will become input, and the output that becomes input will be processed by the second command. If you need to save the output, you need to copy an output. The command used is "tee".
This lab is operated under ordinary users:
Find / etc/-name passwd | wc-l will see a result of 2 because the error output cannot go through the pipe
Find / etc/-name passwd 2 > & 1 | wc-l will see 19 because the output numbered 2 is converted to numbered 1 by "2 > & 1".
Find / etc/-name passwd 2 > & 1 | tee file | wc-l saves an output to file in counting the number of lines
4.3. Input redirection
Cat > file
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.