Do Two or More Things

There are a few ways you can do this.

Separating commands with a ; (semicolon) will execute the second command after the first command is complete, regardless of the result of the first command:

matthew@seymour:~$ command1 ; command2

If you want the second command to be run only if the first command exited with no errors, use && (two ampersands):

matthew@seymour:~$ command1 && command2

If you want the second command to be run only if the first command fails, use || (two pipes):

matthew@seymour:~$ command1 || command2

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.