Does a Linux command set with descriptions exist on the net?
I have a list of commands I obtained by using alt! with 1947 commands listed. I put these into a file, but I am having to write what each command does by using the whatis
command and then copying the result next to the command into the text document.
Is there an easier way to generate this list?
If your purpose is to have a document listing the whatis output for every system command on your machine, do:
2>&1
to that command2> dark-commands.txt
insteadActually, to be a proper encyclopedia, you'll want to have it sorted as well!
Better yet, make it interactively searchable (thx for the suggestion @Doogfar!):
Now use / to search forward and ? to search backward, or Ctrl+F/B to page forward and backward in your encyclopedia.
Tip: if you want to save yourself the typing every time you need your command encyclopedia, put it in a shell function as described in this answer.
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.
In a
bash
shell (which is what you get when you open a Terminal window), you can do it with bash completion. Type inwhich
(including the space at the end), and press Tab twice.Then you'll be prompted with something like:
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 runthen it will put it in a file called
typescript
in the current directory.The
script
command records all the text in the Terminal. So after runningscript
, typewhich
(with the space, as before), type Tab twice, and 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 runexit
. Nowscript
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:Then
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 iszsyncmake
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.)