Have you failed a job interview?
Send us your job interview questions and get correct answers.

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

Answer

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

Example:

clear && pwd && ls

Comments

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