Bash Using cat Read from standard input

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

cat < file.txt

Output is same as cat file.txt, but it reads the contents of the file from standard input instead of directly from the file.

printf "first line\nSecond line\n" | cat -n 

The echo command before | outputs two lines. The cat command acts on the output to add line numbers.



Got any Bash Question?