Difference Between “|” and “&&” When Running 2 Commands at Once

Difference Between “|” and “&&” When Running 2 Commands at Once

Have you ever wanted to run 2 commands at once? If you want to run 2 commands at the same time, use | . If you want the first command to run successfully before running the second command, use &&.

In the video above, I use sleep 5 to pauses the execution for 5 seconds.

When using |, “Hello” was displayed right away. When using &&, “Hello” was displayed after 5 s.

Search

Related Posts

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran