Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 121343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:57:21+00:00 2026-05-11T03:57:21+00:00

Question: I have a question that is apparently not answered by this already-asked Bash

  • 0

Question: I have a question that is apparently not answered by this already-asked Bash completion question on Stack Overflow. The question is, how to get Bash alias completion (for any alias) on a partial substring.

Example: For example, assume I have the following aliases:

open.alicehome='cd /usr/home/alice' open.bakerhome='cd /usr/home/baker' open.charliehome='cd /usr/home/charlie' gohomenow='shutdown -now' 

I would like to lazily just type ‘baker{{TAB}}’ to invoke the second alias.

I would like to lazily just type ‘home{{TAB}}’ to get a list of all of the above aliases that I can then choose from with the keyboard (optimal) or choose by typing an unambiguous substring that distinguishes among the three options (less than optimal).

.. OR ..

I would like to lazily just type ‘home’ and then repeatedly press {{TAB}} until the specific alias I want shows up, then press {{ENTER}} to execute it.

Feel free to be creative: If you have a way to do this, even if it requires resorting to extreme guru hackery, please feel free to share it and feel free to explain your guru hackery to the level of a five-year-old who will have to try to implement your idea for himself.

Links to existing web-pages or RTFMs are welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T03:57:22+00:00Added an answer on May 11, 2026 at 3:57 am

    You can generate the matches for a specified substring with compgen -c -X'!*substring*'

    To include this in bash autocompletion you can create a .bash_completion file in your home directory containing something like this:

    _comp() {     local cur      cur=${COMP_WORDS[$COMP_CWORD]}      COMPREPLY=( $( compgen -c -X '!*'$cur'*' ) )  } complete -F _comp $nospace eval 

    This match function will run when you press <TAB> on the arguments to the eval command. I haven’t found a way to include a new matching function for the first command search in bash, I’ve only found documentation on how to add custom completions for a specific command, like eval above.

    But I’m a bit skeptical to how useful this is… There is no easy way to select which match you want from the list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with this question from my professor. Here is the question:
I have a function that I'm using to prevent multiple postbacks of a form:
So apparently the support you get from Varien when you purchase the Enterprise Edition
I have a string that stores some variables that must be executed to produce
Apparently you can't have a Nullable<Rectangle> in Silverlight. I'd like to know the technical
Why is substringFromIndex not working for my NSMutableString ? Here code similar to what
This is driving me crazy. I created a Dynamic Web Project in eclipse and
I'd want to hear various opinions how to safely use c++ in mission critical
Scenario: I'm trying to intercept paste events inside a textarea/input text, and filter the
I thought I knew how to declare version numbers for modules. But after reading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.