How To Disable Bracketed Paste in BASH and ZSH

Published Date Author: , Posted March 5th, 2025 at 6:30:55am

Bracketed paste is a feature in modern shells that helps prevent accidental execution of pasted commands by wrapping them in special escape sequences. However, some users find this behavior annoying, especially when pasting multi-line commands. Fortunately, it’s easy to disable bracketed paste in both BASH and ZSH.

Disabling Bracketed Paste in BASH

To turn off bracketed paste in BASH, modify your ~/.inputrc file by adding the following line:

You can apply this change immediately by running:

Otherwise, restart your terminal or open a new session for the changes to take effect.

Disabling Bracketed Paste in ZSH

For ZSH users, disable bracketed paste by adding the following line to your ~/.zshrc file:

After saving the file, reload your ZSH configuration with:

Bonus: Enhancing TAB Completion

If you’re customizing your shell, consider tweaking TAB completion behavior to improve your experience. Add these lines to ~/.inputrc for a more intuitive tab completion experience:

After modifying ~/.inputrc, apply the changes with:

### Explanation of TAB Completion Tweaks:

  • set bell-style none – Disables the terminal bell sound.
  • set completion-ignore-case on – Makes tab completion case-insensitive.
  • set show-all-if-ambiguous on – Displays all possible completions when multiple matches exist.
  • TAB: menu-complete – Enables menu-based tab completion.

With these tweaks, you can optimize your shell experience and eliminate unwanted behavior while improving command-line efficiency!

Extra Bonus: Dynamic Terminal Title

Sometimes my Terminal title gets stale, so I wanted a command to dynamically set it to the hostname and current working directory.

This will set your terminal title to display the short hostname and current working directory, making navigation easier when working across multiple terminals.

No comments as yet.

Leave Your Comment  Leave a comment

All fields marked with "*" are required.