I have seen this " | " in some commands on the Linux shell but I don't know what it means in general. For example, when I run jobs on a shared cluster which uses PBS job scheduler, I can check where the job running is with this command:

qstat -j <jobid> | grep cwd

I want to know the more general meaning of | so I can apply it elsewhere when it's applicable, instead of just learning by heart the commands when I see others using it.

Thank you in advance. :)

marked as duplicate by steeldriver command-line Aug 8 '18 at 18:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


This is not Ubuntu specific, but more a general Linux question, however...

The | symbol is what's known as a pipe. It allows you to "pipe" the output of one command into another. For example:

ls | grep foo

This will list the files (ls) then send the output to grep to eliminate all content not matching foo

Check out Piping in Unix or Linux for more detailed information.

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