The pipe (|) is used to redirect the output of one command as input to another command. It allows chaining multiple commands together to perform complex operations by passing the output of one command to the input of another.

head -n 5 file.txt | sort | tail -n 3