From the course: Ubuntu Linux: Essential Commands

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Input/output redirection

Input/output redirection

From the course: Ubuntu Linux: Essential Commands

Start my 1-month free trial

Input/output redirection

- [Narrator] It can be useful to change where the output from a command goes. This is called redirection, and we can redirect text both into and out of a command. We can also use what are called pipes to send the output one command to another command as input. To start with, let's use the echo command, which takes text as an input and just returns it back to us as an output like this. I'll write echo some text. If I want the response to go somewhere other than the terminal output here, which is called the standard output, I can use a greater than sign to send it to a file. I'll write echo "some text" > output.txt. I don't get any response now, and if I write cat output.txt, I can see that the output that I would have seen at the terminal is inside this file instead. If were to echo something else to the file, and then take a look at that again, that information has completely replaced what was there before. That's because the single greater than operator replaces the contents of…

Contents