From the course: Unix Essential Training

Unlock the full course today

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

Directing input from a file

Directing input from a file - Unix Tutorial

From the course: Unix Essential Training

Start my 1-month free trial

Directing input from a file

- [Narrator] In this movie, we'll learn how to use a file as input to a command. It's much less common to direct input to a command than to direct the output from it. It's not because file input is uncommon. It's because it's so common that most commands take a file as an argument, but for commands that don't, we can direct input to them anyways. And we can do that by using the less than operator. Exactly the same as we saw with output, but pointing in the other direction. So I have the command and then the less than operator and then the file that I want to send as input. Of course, this has to be a file that actually already exists if I'm going to use it as input. It may seem odd at first to have the input come after the command, but Unix wants it this way. Unix wants the command to be the first thing on the line, and then the input operator is that less than sign. If it was on the other side, it would be using the…

Contents