linux IO redirection

linux IO redirection

The default output device: standard output, STDOUT, 1
Default input device: standard input, STDIN, 0
Standard error output: STDERR, 2

Linux I/O redirection:

>: Override Output
eg. [root@mylab]# ls /var > /tmp/var2.out
>>: Append output
set -C: already prohibits the use of file redirection coverage
Force overwrite output, use the >|
set +C: Close the above functions
2>: Redirect error output
2>>: append mode
eg. [root@mylab]# ls /varr > /tmp/var3.out 2> /tmp/err.out
$>: Redirect standard output or error output to the same file
<: Input redirection
eg. [root@mylab]# tr 'a-z' 'A-Z' < /etc/fstab
<<: Here Document
eg. [root@mylab]# cat << END
     > The first line.
     > The second line.
     > END
     The first line.
     The second line.
     [root@mylab]# cat >> /tmp/myfile.txt << EOF (save input into myfile.txt)
     > The first line.
     > The second line.
     > EOF

linux Pipeline:

before and after the output of a command as a command input
Command 1 | command 2 | command 2 | ...
eg. echo "hello, world." | tr 'a-z' 'A-Z'

    echo "redhat" | passwd --stdin hive

    wc -l / etc / passwd | cut -d '' -f1

Pingbacks are closed.

Trackbacks
Comments