I want my terminal to automatically close my brackets, quotation marks, etc.

For example, I want to type ( and I want it to complete to


where | represents the mouse cursor.

Is there a way to do this? If so, how?

  • Reimplement GNU Readline, that's the thing that gives you history and the ability to move your cursor. – cat Mar 12 '16 at 15:42

bash reads ~/.inputrc file, which allows binding certain keys to macros. In our case, we need macro that automatically types in "()" and Ctrl+b (which is move back one word ) shortcut.

Open the file with gedit or any other text editor and type in the following


That will bind Ctrl + ] to do what you want. Now open terminal or call a new instance of the shell and test it out.

You can try binding it to any other keyboard short-cut, but there is only so much you can do.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.