Data Stream for Input
STDIN – 0
Data Stream for Output
STDOUT – 1
Data Stream for Output that relates to an error occurring.
STDERR – 2
find /etc/ -name shadow 2>/dev/null
redirect errors to null
Redirect STDOUT to a File
find /etc/ -name shadow 2>/dev/null > results.txt
Redirect STDOUT and STDERR to Separate Files
find /etc/ -name shadow 2> stderr.txt 1> stdout.txt
Redirect STDIN
cat < stdout.txt
Redirect STDOUT and Append to a File
find /etc/ -name passwd >> stdout.txt 2>/dev/null
Redirect STDIN Stream to a File
cat << EOF > stream.txt
End-Of-File (EOF) function of a Linux system file, which defines the input's end.
Pipes
to use the STDOUT from one program to be processed by another.
find /etc/ -name *.conf 2>/dev/null | grep systemd
find /etc/ -name *.conf 2>/dev/null | grep systemd | wc -l
Comments
Post a Comment