Tag Archives: terminal

More Useful Bash/Terminal Settings

A few more tricks to make your bash environment better. As always, add them to your ~/.profile or ~/.bash_profile to enable.

Disable the pagination of long lists when ambiguously tab completing.

bind 'set page-completions off'

Increase max returned items before being prompted. (ie, “Display all 380 possibilities? (y or n”). You can set the number to whatever you’d like.

bind 'set completion-query-items 300'

Show the list of autocompletion options after the first tab. This prevents the beep + second tab behavior.

bind 'set show-all-if-ambiguous on'

When autocompleting for cd or rmdir, list only directories as choices.

complete -d cd rmdir

Autocompletion for ssh known_hosts. Add this to your ~/.ssh/config (if the file doesn’t exist, create it)

Host *
HashKnownHosts no

Make grep highlight the matching terms in its output.

export GREP_OPTIONS='--color=auto'

Ignore case for case preserving but insensitive filesystems (like HFS+). I don’t personally use this, but perhaps some people will like it.

bind 'set completion-ignore-case on'

Don’t show hidden files when listing. Another option I don’t personally use.

bind 'set match-hidden-files off'

Delete Sends Ctrl-H

Delete Sends Ctrl-H in TerminalIf you’re a Mac user who utilizes Terminal.app with any regularity you have probably run into some Linux servers where the Mac Delete key behaves as forward delete instead of backspace (Ubuntu, Debian, and a few other distributions have this issue). This is a really obnoxious problem, but fortunately there is an easy global fix.

To repair the problem you’ll need to go to the Terminal.app preferences, select settings, then under the default theme you’re using click the advanced tab.  Now you can check the “Delete Sends Ctrl-H” option and close the prefs. Any existing windows will retain the old behavior but new tabs/windows will now behave as expected.