Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Thursday, April 7, 2022

Linux: Input Output (IO) Redirection


Output Redirection(>,>>): It represents the output of a command to some standard output.

who > users

cat users

date >> users # append date in users file

cat user


Input Redirection(<): It redirects the input of a command to a file.

cat filename

cat< filename


Here document(<<): It is used to redirect input into an interactive shell or program.

wc -l << EOF

> This is simple line

> this is also simple line

> EOF


Discard Output

Sometimes you need to execute the command but you don't want the output to be displayed on the screen, in such cases then you can discard the output by redirecting it to /dev/null

Example

whoami > /dev/null

(null is a special type of file which discards the input as soon as it receives)

Fluentd

Open-source log data collector > why logs? - for compliance (auditing, company, business) - for security (transparency, monitoring, admin...