I remembered bash can do the following:
Suppose there are 3 files: a,b,c in the current directory, when I input:
$> somecommand *
and then press a key or key combinations or a key sequence, the wildcard * online expanded as:
$> somecommand a b c
but I cannot remember and cannot google out the key sequence! help!
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
If it is not, you would need to bind glob-expand-word to a key sequence. Typically by by adding something like:
"C-x*": glob-expand-word
to .inputrc.
To check current status issue something like:
bind -P | grep glob-expand-word
Where result might be:
glob-expand-word can be found on "C-x*".
Which would mean:
Ctrl-x*
This also most likely work:
Ctrl-xCtrl-*
Have a look at bind -P and manual(s) for other niceties.
- Miscellaneous-Commands
- GNU command line editing interface: Command-Line-Editing
Method 2
It seems you are looking for list completion. In the man page for bash:
COMP_TYPE
Set to an integer value corresponding to the type of completion
attempted that caused a completion function to be called: TAB,
for normal completion, ?, for listing completions after succes‐
sive tabs, !, for listing alternatives on partial word comple‐
tion, @, to list completions if the word is not unmodified, or
%, for menu completion. This variable is available only in
shell functions and external commands invoked by the program‐
mable completion facilities
So it depends on the completion function for somecommand how this is completed.
Method 3
If you are using set -o vi in bash, then Ctrl-X* doesn’t work.
In set -o vi mode you need to use Esc* instead.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0