---

A Look at the Compgen Bash Builtin

“To get everybody up to speed–when I say completions, what I
mean is command names, paths, and so on, that might be completed
when given a part of a string. For example when you’re typing a
command and start with “apr”, you could get apropos on an Ubuntu
system.

To figure this out using compgen you could use compgen -c | grep
apr. To quickly figure out all directories, you could cd to in a
directory, just use compgen -d. (Or compgen -d | sort if you want a
neat list…)


Complete Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis