[Linux](EN) Difference between && and ; in shell command

Difference between && and ;

Environment and Prerequisite

  • Ubuntu
  • CentOS


Difference

  • ;: execute next command whether previous command was successfully executed or not
$ apt-get install gcc; apt-get install gdb


  • && means AND so next command will be executed only if previous command was successfully executed(return true)
$ apt-get install gcc && apt-get install gdb