Listing all possible commands is not very useful, but it can be done pretty simply.
This method lists both commands that exist as executables, and shell builtins.
bash shell (which is what you get when you open a Terminal window), you can do it with bash completion. Type in in
which (including the space at the end), and press Tab twice.
Then you'll be prompted with something like:
Display all 3734 possibilities? (y or n)
Press y. You can scroll down through the list of commands by pressing Spacebar. Press q at any time to leave the list.
This way of viewing the list is inconvenient, because you can only move down in the list, not up. To create a file containing the list, run:
This will create the list in a file called
command-list.txt located on your Desktop. You can change it accordingly. If you just run
then it will put it in a file called
typescript in the current directory.
script command records all the text in the Terminal. So, after running
which (with the space, as before`, type Tab twice, press y when prompted.
Now, scroll down through the list by holding down the spacebar key. Once you get to the end of the list, you'll be back on the line where you're typing the
which command. Type Ctrl+C to get a new line, then run
script is no longer recording.
To view the file, open it in a text editor--in Lubuntu, Leafpad; in regular Ubuntu, Gedit. (Those editors are installed by default, but of course you can install and use whatever text editor you like.)
As you view it, you'll see imperfections where you were prompted for
More. But that shouldn't interfere with your ability to read through the file, to look up commands in it, nor to search through the file to find a particular command (or commands containing specific text).
If you want, you can filter out those lines. If the file is
~/Desktop/command-list.txt, you can run:
grep -ve --More-- ~/Desktop/command-list.txt > ~/Desktop/command-list2.txt
command-list2.txt on the desktop won't have those lines.
: will be the first command listed. The last command listed may vary from system to system (it depends on what software you have installed). On my system it is zsyncmake but you might not have that, or you might have a command that ranks after it alphabetically.
If you like, in the text editor you can manually remove text before the first command and after the last command. (It's just a few lines at the beginning and end; removing it by hand is much easier than if you had to remove all the
--More-- lines by hand.)