Linux redirect

Today about redirects.

What is a redirect?

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

How to use redirects

-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

Standard input, standard output, standard error

In Linux, it is allocated as follows by default. ・ Standard input → 0 ・ To standard output → 1 ・ Standard error output → 2

Let's actually try
  1. Standard output

① 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


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

Linux redirect
Linux redirect vol.3
linux memorandum
Linux command # 4
Linux commands
Linux command # 3
Linux overview
Linux basics
direnv (linux)
Organize Linux
linux commands
Linux practice
Ubuntu Linux 20.04
Linux process
Linux command # 5
About Linux
Linux basics
Forgot linux
About Linux
Linux commands
Linux commands
About Linux
About Linux
About Linux ①
Linux command list
[Linux] About export
[Linux] Symbolic link
Linux environment construction
linux mono uninstall
Network Linux commands
[Linux] Search command
Linux x memo
Linux command <Basic 2>
Verbalize Linux commands
Why use linux
Linux (CentOS) construction
linux (ubuntu) memo
Linux memorandum [links]
What is Linux
Linux study notes
Linux interprocess communication
[Linux] Proxy application
Linux [directory command]
Linux directory structure
Linux server command
Redirect with Pyramid
Linux # Command Memo 1
Linux command [read]
Linux standard textbook
Linux Command Summary
After installing Linux
[Linux] DNS settings
[Basic] linux command
Linux [shell command]
New Linux commands! !!
Basic LINUX commands
[Linux] About PATH
[Linux] Introduction to Linux
[Linux] Command / Knowledge