pipelines and redirects:> < << >>
Computer 5 major devices: Arithmetic, controller (CPU), Memory (RAM), input device, output device
Programs: Directives and data
Address bus: Memory addressing
Data bus: Transferring data
Control Bus: Control instructions
Register: CPU Ephemeral memory
I/O devices:
Input device:
Output device:
System settings
Default output device: Standard output, STDOUT, 1
Default input device: standard input, Stfin, 0
Standard error Output: STDERR, 2
Standard output: Keyboard
Standard output and Error output: Display
I. I/O redirection
Output Redirection (>): Overwrite output
(>>): Append output 650) this.width=650; "Src=" http://s5.51cto.com/wyfs02/M00/7A/C2/ Wkiom1azvdpd5lp2aaa2zbqxzn8077.gif "style=" width:550px;height:423px;float:left; "title=" Output redirect 1.gif "height=" 423 " Hspace= "0" border= "0" vspace= "0" width= "550" alt= "Wkiom1azvdpd5lp2aaa2zbqxzn8077.gif"/>650) this.width=650; "Src= "Http://s5.51cto.com/wyfs02/M01/7A/C2/wKiom1azVDTCqG-CAABICQlsbqw687.gif" style= "WIDTH:550PX;HEIGHT:249PX;" title= "Output redirect 2.gif" height= "249" hspace= "0" border= "0" vspace= "0" width= "550" alt= "wkiom1azvdtcqg-caabicqlsbqw687.gif "/>
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/7A/C2/wKiom1azVDTzRhvrAABk7qTQGw4688.gif "style=" width : 550px;height:556px; "title=" Output redirect 21.gif "height=" 556 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiom1azvdtzrhvraabk7qtqgw4688.gif "/>
SET-C: Disable overwrite redirection for already existing files
Set+c: Allow overwrite redirection for already existing files
Force overwrite output, use >|
2>: Redirect Error output
2>>: Append method
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7A/C1/wKioL1azVPShzFuOAABvN-kU9A4419.gif "style=" width : 550px;height:545px; "title=" Output redirect 3.gif "height=" 545 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1azvpshzfuoaabvn-ku9a4419.gif "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/7A/C1/wKioL1azVPSDFMXiAAAwfipwFdA796.gif "style=" width : 550px;height:220px; "title=" Output redirect 3-1.gif "height=" "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1azvpsdfmxiaaawfipwfda796.gif "/>
&>: Redirect standard output or error output to the same file
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7A/C2/wKiom1azVJPzG8fWAAAo74jvlv4475.gif "title=" Output redirect 4.gif "alt=" Wkiom1azvjpzg8fwaaao74jvlv4475.gif "/>
Ii. Input Redirection (<): Enter into the specified file (Show/execute)
(<<): Here document generates documents here
third, Pipeline : The output of the previous command, as the input of the latter command
Command 1 | command 2 | Command 3 | ...
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/C2/wKiom1azVPCjk8F8AAAza6UTFXE682.gif "title=" Input redirect 1.gif "alt=" Wkiom1azvpcjk8f8aaaza6utfxe682.gif "/>
Tee: Read data from standard input, output to a copy of the screen, and save to a file
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/C1/wKioL1azVXPxdK4BAABUVuGt9Lw173.gif "style=" width : 550px;height:289px; "title=" Input redirect 2.gif "height=" 289 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1azvxpxdk4baabuvugt9lw173.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/C2/wKiom1azVSLR6FS7AAA4c2GS8ro999.gif "style=" float: none; "title=" Input redirect 3.gif "alt=" Wkiom1azvslr6fs7aaa4c2gs8ro999.gif "/>
4-3 Practice
1, Count files in/usr/bin directory
# ls/usr/bin | wc-l
2, remove shell for all users on the current system, request, Each shell is displayed only once and is displayed sequentially, counting the number of occurrences of each shell
# cut-d:-f7/etc/passwd | sort-n | uniq-c
3, thinking: How to display the/V What is the content type of each file in the Ar/log directory?
France:
# cd var/log
# file ' ls/var/log '
II:
# file/var/log/*
4, remove the 6th line of the/etc/inittab file
# head-6/ Etc/inittab | TAIL-1
5, take out the user name and shell of the 9th user in the/etc/passwd file, display it to the screen and save it to the/tmp/users file
# tail-9/etc/ passwd | head-1 | Cut-d:-F 1,3 | Tee/tmp/users
6, display all files starting with PA in/etc directory, and count the number of them
# ls-d/etc/pa* | wc-l
7, text Editor not applicable, alias cls= The clear line is added to the current user's. bashrc file
# echo "Alias Cls=clear" >> ~/.BASHRC
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/C1/wKioL1azVavCDeBAAAAg3IMn_6Q977.gif "style=" float: none; "Title=" 4-2 exercise 1.gif "alt=" Wkiol1azvavcdebaaaag3imn_6q977.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/C1/wKioL1azVavxxk2tAABI99l7Ff0040.gif "style=" width : 550px;height:458px; "title=" 4-2 exercise 2.gif "height=" 458 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1azvavxxk2taabi99l7ff0040.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/C2/wKiom1azVVrhC2IWAAA7Y3vI5Kg344.gif "style=" float: none; "title=" 4-2 Practice 3-1.gif "alt=" Wkiom1azvvrhc2iwaaa7y3vi5kg344.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/C2/wKiom1azVVqRgPq8AACVC5k_dww008.gif "style=" width : 550px;height:491px; "title=" 4-2 exercise 3-2.gif "height=" 491 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiom1azvvqrgpq8aacvc5k_dww008.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/7A/C1/wKioL1azVazy0ygGAACBqtTNVYA674.gif "style=" width : 550px;height:550px; "title=" 4-2 exercise 4.gif "height=" 550 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiol1azvazy0yggaacbqttnvya674.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/C2/wKiom1azVVuD8iuAAAAzgXcu0T8936.gif "style=" width : 550px;height:171px; "title=" 4-2 exercise 5.gif "height=" 171 "hspace=" 0 "border=" 0 "vspace=" 0 "width=" 550 "alt=" Wkiom1azvvud8iuaaaazgxcu0t8936.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7A/C1/wKioL1azVa2hP7JnAAA4KJ_vfQA466.gif "style=" float: none; "Title=" 4-2 exercise 6.gif "alt=" Wkiol1azva2hp7jnaaa4kj_vfqa466.gif "/>
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/7A/C1/wKioL1azVa2xhs6LAAAi4-FPJW4492.gif "style=" float: none; "Title=" 4-2 exercise 7.gif "alt=" Wkiol1azva2xhs6laaai4-fpjw4492.gif "/>
This article is from the "11160930" blog, please be sure to keep this source http://11170930.blog.51cto.com/11160930/1741159
2016-2-4 Linux Basic Learning 10