What does "logout" command do on MacOS terminal

It terminates the shell (typically bash or zsh) running in a Terminal tab/windows.

Some background:

  • Unix shells can run as login or as non-login shells (which has some implications on which configuration files are read at startup).
  • On a standard macOS installation, each Terminal tab/window runs a login shell.
  • To end the shell process, you can either run logout, exit, or simply press Ctrl + D.

It is worth noting that if you don't know what a terminal command does it is possible to find information from the manpage.

So, to find out what the command logout does you can enter

man logout

at the command prompt.