How to use Autocomplete and Autosuggestion in Shell Commands

If you see the Terminal a lot to run commands, you will really like speed things up to save time and be more efficient, one of the features that you can use for this is called autocomplete,

✌️Tab is the keyboard key that you can make use of for autocomplete and autosuggestion feature

Autocomplete example:
Autocomplete in Zsh Shell Example
Autocomplete in Shell Gif Example

As you can see in the above example when I type cd to change directory and type bi followed by tab key based on the current directory there is only one dir that starts with bi so it's autocompleted to bin

Also, when in the example, I typed cd m followed by pressing the tab key, nothing happened, when I pressed it twice, you get autosuggestions that all files and directories start with the letter m, as I wanted to select the media directory, I simply pressed key e followed by tab!

# cd bin
# cd ..

# cd m
media/ mnt/   mydir/ 
# cd media/
Try Out Code2care Dev Tools:


Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.