Instead of displaying all possibilities on terminal screen, as in:
$ ls /etc/<TAB>
Display all 230 possibilities? (y or n)
I want to save all possibilities to a file.
ls /etc/ > file.txt will not always work. apt-get is an example:
$ apt-get <TAB>
autoclean check install update
autoremove clean purge upgrade
build-dep dist-upgrade remove
changelog dselect-upgrade source
I'm looking for a command like tabcompletions 'ls /etc/' which outputs all possibilities, so that I can run a command like the one below, which compares the tab completion possibilities for two commands:
diff <(tabcompletions 'ls ') <(tabcompletions 'cd ')
Is that possible?