Most of the time, we can use commands efficiently with the help of Linux’s automatic completion capability.

TAB Completion

Variable Tab

1
$HISTS    # press Tab key to auto-complete this command
img

before completing

img

after completing

Command Tab

1
ec    # press Tab key to auto-complete this command
img

before completing

img

after completing

File Tab

1
    # press Tab key to auto-complete this command
img

before completing

img

after completing

Possible Completions

Can we use Alt+Shift+? keys to print out possible completion options.

Variable Alt+Shift+?

1
$HISTS    # press Alternate and Shift and Question Mark keys to print the possible variables
img

before printing possible variables

img

after printing possible variables

Command Alt+Shift+?

1
ec    # press Alternate and Shift and Question Mark keys to print the possible variables
img

before printing possible commands

img

after printing possible commands

File Alt+Shift+?

1
/bin/le    # press Alternate and Shift and Question Mark keys to print the possible variables
img

before printing possible files

img

after printing possible files

Specific Completion

We can also get the corresponding completion through a specific combination of keys.

File Alt+Shift+/

1
/bin/le    # press Alternate and Shift and Slash Sign keys to print the possible variables
img

before completing a nearest filename

img

after completing a nearest filename

Username Alt+Shift+~

1
ro    # press Alternate and Shift and Tilde Sign keys to print the possible variables
img

before completing a nearest username

img

after completing a nearest username

Variable Alt+Shift+$

1
$PA    # press Alternate and Shift and Dollar Sign keys to print the possible variables
img

before completing a nearest variable

img

after completing a nearest variable

Hostname Alt+Shift+@

1
dongc    # press Alternate and Shift and At Sign keys to print the possible variables
img

before completing a nearest hostname

img

after completing a nearest hostname

Command Alt+Shift+!

1
ec    # press Alternate and Shift and Exclamation Mark keys to print the possible variables
img

before completing a nearest hostname

img

after completing a nearest hostname

References 8.4.6 Letting Readline Type For You

Buy me a coffeeBuy me a coffee