I'm trying to understand this shell cmd.

I understand that:

convox exec <pid> is going to execute the following cmd in the container with pid as the ID

< file.txt work redirects the content of file.txt file as input to the convox cmd

> file.txt overwrite the file context with whatever is on the left of that > redirect operator

Then the question is what does that cat - do? How does the content of my local file.txt get passed to the command that is going to run within the container?


The cat - > file.txt command is executed inside the container, while the < file.txt, which is outside of the quotes ("..."), affects the convox exec command itself.

In other words, this redirects stdin for the convox exec command from stdin, and then cat - > file.txt reads from stdin and writes to the file file.txt inside the container.

  • Thank you for the answer, I never seen the cat - syntax, is that part of shell or convox cmd? could you give me a link to some reference? I try to google it but didn't get anything. – Jerry Mar 27 at 12:07
  • 1
    cat is a standard unix command that reads one or more files and writes them to stdout. - is a special argument that means stdin. cat reads from stdin by default, so cat - > file.txt is equivalent to cat > file.txt. – larsks Mar 27 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.