Disable Command-W in the terminal

keyboardterminal

Is there any way to disable Command+W in the terminal?

On several occasions I have accidentally closed a terminal window containing important information when I meant to close a Safari tab and did not realize that the terminal was the active window.

Best Answer

To disable W in Terminal, do the following:

  • From the  menu in the top left corner of the screen, select System Preferences. Click on Keyboard then Keyboard Shortcuts then Application Shortcuts. enter image description here

  • Click the + button to add a new shortcut

  • Select "Terminal.app" for the application, and for the command, type Close Window (this is case sensitive). In the shortcut box, give it a different shortcut, like ControlW enter image description here

  • Now W will not close your terminal windows.