Linux pipe character/redirection

Today, I will mainly talk about small knowledge points such as pipe symbol and redirection. Because the content is simple, I will introduce it as briefly as possible, and let everyone learn the knowledge in the most simple and understandable way.
1. Pipe symbol is
about pipe symbol. No stranger. I saw the understanding of netizens on the Internet, and I felt very good, so I glued it down for everyone to see, and then there are also screenshots of pictures of my own system for testing. You can take a look.
Insert picture description here
Insert picture description here
This pipe symbol is really not difficult, so I won't talk about it, let's look at redirection next.
2. Redirect to
Insert picture description here
look at the above picture. I did the test, the first time I got the complete output, but the second time it prompted that there was no such file. The difference between the two is that the standard output is returned for the first time, and the standard output is returned for the second time. Is the error output. Next
Insert picture description here
, let’s take a closer look: 1) Here are three examples of output redirection :
Insert picture description here
First, I created a readme.txt file, and then entered "hehehehehehehhehhehehehehehehhh" in it, and then I used the first method **"Command> File" , input "lallalallallallalallallal" into it, and then check the content to find that the latter has indeed replaced the former. This is the place to be noted. This method will clear the original data! ! !
Then I used the three methods
"Command >> File" and entered "jijijijijijijijijijijiji" into it, and I found that there was more new data in the content this time, but the original data was not deleted.
Insert picture description here
Finally, give another example of redirection of wrong output.
Insert picture description here
2) Let’s give another example of
input redirection**.
Insert picture description here
Here I send an email to user gao with the subject of "huanying", where "over" is a subsection. The default system will determine the end of the input when it encounters over.
3. Wildcard
Insert picture description here
Insert picture description here
1) View all devices starting with sda
Insert picture description here
2) Match any single character
Insert picture description here
3) View devices that include numbers 0-9 in sda
Insert picture description here
4) Match existing devices
Insert picture description here
At the same time, bash also supports some other characters as follows:
Insert picture description here
Say it today to here! ! !

Guess you like

Origin blog.csdn.net/Gao068465/article/details/108118244