Just checking, because I learnt to type before I worked this out, and because surely someone reading doesn’t know: press tab. Bash will fill in file names from your current directory.
E.g. say you have files fred1file, fred2file, jim.
Type f then press tab, it will fill to “fred”. Then press 2 and press tab again and it will fill the full “fred2file”.
Just checking, because I learnt to type before I worked this out, and because surely someone reading doesn’t know: press tab. Bash will fill in file names from your current directory.
E.g. say you have files fred1file, fred2file, jim.
Type f then press tab, it will fill to “fred”. Then press 2 and press tab again and it will fill the full “fred2file”.
Have a play, it works in heaps of situations.
Bash will also do autocomplete for cli programs that have autocomplete functionality. Try typing:
git r<tab><tab>
you’ll see options for all the git commands that start with r. Often cli commands will have autocompletion for long (double dash) options.
If you want to see all the commands that have auto complete available, look in:
/usr/share/bash-completion/completions/
There’s a few other locations they can live, notably:
/etc/bash_completion.d/ ~/.bash_completion ~/.local/share/bash-completion/completions/
I don’t know if there are more or if there is any variation per distro.
You can also write your own bash completions. They can get pretty smart and context sensitive.
Pretty good beginning tutorial:
https://iridakos.com/programming/2018/03/01/bash-programmable-completion-tutorial