0 votes
in Linux by
Explain the redirection operator.

1 Answer

0 votes
by

Explain the redirection operator.

The redirection operator is used to redirect the output of a particular command as an input to another command or file.

There are two ways of using this:

‘>’ overwrites the existing content of the file or creates a new file.

‘>>’ appends the new content to the end of the file or creates a new file. 

Suppose the content of the file is as follows:

cat file - linux interview questions - madanswer.com/linux

Now when you use the ‘>’ redirection operator, the contents of the file are overwritten.

redirection operator overwritten - linux interview questions - madanswer.com/linux

and when you use ‘>>’, the contents are appended:

redirection operator append - linux interview questions - madanswer.com/linux

...