Today about redirects.
Changing the destination of the output, that is, forcibly jumping to another page when moving to one page. In Linux, changing the destination means standard input, standard output, and standard error output.
In this command example, it is as follows.
・ Standard input: ʻecho Hello_World -Standard output:
Hello_World · Standard error:
-bash: ech: command not found`
Command example
[root@taki ~]# echo Hello_World Hello_World [root@taki ~]# ech Hello_World -bash: ech: command not found
-Output standard output to a file → You can save the character string output on the screen to a file → On the command line, the screen is filled with a large amount of character strings. ** If you do nothing, the result will flow up and off the screen. There is a situation where you cannot check the result even if you try to check it. ** ** → Save and view the result in a file using redirect
In Linux, it is allocated as follows by default. ・ Standard input → 0 ・ To standard output → 1 ・ Standard error output → 2
① Standard output
[root@taki ~]# echo Hello_world Hello_world
② Hello_World is output to Test_Hello_World.txt
[root@taki ~]# echo Hello_World > Test_Hello_World.txt [root@taki ~]#
③ Confirmation of ②
[root@taki ~]# cat Test_Hello_World.txt Hello_World
④ Hello_World is output to Test_Hello_World.txt
[root@taki ~]# echo Hello_World > Test_Hello_World.txt [root@taki ~]#
⑤ Close_World is output to Test_Hello_World.txt
[root@taki ~]# echo Close_World >> Test_Hello_World.txt
⑥ Confirmation of ⑤
[root@taki ~]# cat Test_Hello_World.txt Hello_World Close_World
What you can see from the above
symbol | Description |
---|---|
> | Specify the output destination of standard output |
>> | Specify the output destination of the standard output and add it to the standard input output destination |
https://eng-entrance.com/linux-redirect
It's been long, so today is around here. I was able to add a table. Leave a blank line before the table.
Recommended Posts