Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 in the text document.

Thank you;

Sherman

share|improve this question
    
You might want to try this: 20 useful lesser known commands for Linux users –  evaipar Mar 5 at 16:57

2 Answers 2

up vote 6 down vote accepted

If your purpose is to have a document listing the whatis output for every system command on your machine, do:

find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis > command-encyclopedia.txt
  • To also capture the entries for which there is no whatis output, append 2>&1 to that command
  • To put the undocumented entries in their own document, append 2> dark-commands.txt instead

Actually, to be a proper encyclopedia, you'll want to have it sorted as well!

find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort > command-encyclopedia.txt

Better yet, make it interactively searchable (thx for the suggestion @Doogfar!):

find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less

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.

share|improve this answer
    
I like! Modified slightly you can use it interactivley in alphabetical order "find {,/usr}/{,s}bin -printf '%f\0' | xargs -0 whatis | sort | less" –  Meer Borg Mar 12 '13 at 7:58
    
does this also work for Ubuntu? 12.04? Is this a silly question? –  mojo706 Mar 12 '13 at 8:14
    
Yes, @mojo706. Twice :-). Don't worry, that question had me ROFL. Actually, it already worked in Ubuntu 0.1 and it will still work in Ubuntu Z. And still I made it up right now - see the joy of Linux? For added awe, contemplate that that command line actually starts off four concurrent processes: find, xargs, sort and less are running in parallel, not sequentially. The elegance of the pipes and filters nature of GNU/Linux is what got me hooked, many years ago. –  zwets Mar 12 '13 at 9:01
    
Thank you. That is really helpful. –  Sherman Lee Willden Mar 12 '13 at 16:40
    
This method doesn't list shell-builtins, does it? (And shell built-ins are often some of the most commonly used commands...) –  Eliah Kagan Mar 28 '13 at 14:28

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 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:

script ~/Desktop/command-list.txt

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

script

then 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 running script, type 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 exit. Now 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

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 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.)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.