In this article, we will see how to exit from PostgreSQL command line utility psql. We can exit from PostgreSQL command line tool by using any of below methods.
Method1: Type \q in the psql tool.
Method2: Press Ctrl+D on your keyboard.
Method3: From PostgreSQL 11 onwards quit and exit keywords included.
Method4: Press Ctrl+z from keyboard.
Method5: Press Ctrl+\ from your keyboard.
Visual representation of above methods to exit from psql tool: