Linux command to list all available commands

Linux commands those will list all available commands and aliases for current terminal session:

compgen -c will list all the commands you could run.
compgen -a will list all the aliases you could run.
compgen -b will list all the built-ins you could run.
compgen -k will list all the keywords you could run.
compgen -A function will list all the functions you could run.
compgen -A function -abck will list all the above in one go.

Examples:
[root@localhost C]# compgen -a

Output:

cp
l.
ll
ls
mv
rm
which

[root@localhost C]# compgen -k
Output:

if
then
else
elif
fi
case
esac
for
select
while
until
do
done
in
function
time
{
}
!
[[
]]
coproc

Related Posts

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by k2schools