Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
When I want to close a window I type exit :
mbp-thomas in ~
○ → exit
Then cmd + w to close the window.
Is there a way to do it with a little script like if I type quit it exit the session then close the window ?
Go to Terminal → Preferences….
Select the Settings tab, then your profile, and choose the Shell tab.
Set When the shell exits to Close if the shell exited cleanly.
You could also simply quit Terminal by using Cmd+Q