How do you run multiple commands in Linux terminal but only run the next command if the previous command succeeded?

Experience Level: Junior
Tags: Linux


You can use && separator for this case. && makes sure that the next command will only run when the previous command was successful.


clear && pwd && ls


No Comments Yet.
Be the first to tell us what you think.
Linux for beginners
Linux for beginners

Are you learning Linux ? Try our test we designed to help you progress faster.

Test yourself