LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-05-2018, 03:08 PM   #16
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_12{.0|.1}
Posts: 5,226
Blog Entries: 11

Rep: Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175Reputation: 3175

Quote:
Originally Posted by individual View Post
I counted 57 options for ls. The combinations generated for that is a lot more than any user is going to want to read through.
Taking 57 as the number of available options, there are 395,010 possible ls commands which use different combinations of any 4 of those options. If you take that to all combinations of 5 options... 4,187,106. Try 7 options, 264,385,836. The list for all possible combinations would be the sum of the sub-combinations from 1 to 57... good luck with that!

The task as stated is simply not a reasonable thing to do. And not all combinations will be valid commands anyway, so the list would be useless without reference to the documentation, i.e. man pages of each base command.

As suggested by others, make a list of man pages and/or provide a synopsis.

Last edited by astrogeek; 10-05-2018 at 03:16 PM.
 
1 members found this post helpful.
Old 10-05-2018, 04:43 PM   #17
individual
Member
 
Registered: Jul 2018
Posts: 234

Rep: Reputation: 177Reputation: 177
Quote:
Originally Posted by astrogeek View Post
Taking 57 as the number of available options, there are 395,010 possible ls commands which use different combinations of any 4 of those options. If you take that to all combinations of 5 options... 4,187,106. Try 7 options, 264,385,836. The list for all possible combinations would be the sum of the sub-combinations from 1 to 57... good luck with that!

The task as stated is simply not a reasonable thing to do. And not all combinations will be valid commands anyway, so the list would be useless without reference to the documentation, i.e. man pages of each base command.

As suggested by others, make a list of man pages and/or provide a synopsis.
Thanks for posting some of the numbers. As far as I can tell, the most manageable would be taking 56 options at a time, which still leaves you with 57 combinations.

EDIT: I was going to post my calculation of combinations for the "cat" command in my previous post, but decided against it. There are 10 total options (not counting --help and --version), but 3 are essentially duplicates. You could take at most 7 at a time out of 10, which still leaves you with 120 possible combinations.

Last edited by individual; 10-05-2018 at 04:48 PM.
 
Old 10-06-2018, 08:02 PM   #18
Kenhelm
Member
 
Registered: Mar 2008
Location: N. W. England
Distribution: Mandriva
Posts: 350

Rep: Reputation: 159Reputation: 159
The command syntax example in post #1 can be written as a brace expansion which will expand to a list of commands. The brace expansion in the perl bsd_glob version of glob is better for this than the one in bash because bash treats whitespace as a pattern separator.
http://perldoc.perl.org/functions/glob.html
http://perldoc.perl.org/File/Glob.html
Code:
# Globbing characters '*?[]~' and literal ',{}' need to be escaped with a backslash.
echo '{opt1 main-command <option-123>{, \[num <num>\]}{ avoid, allowable} <SomeVal>{, \[num1 <number_1>\], \[num2 <number_2>\]}{, \[num3 <number_3>\]}{, \[hide <hide>\]}}
{no opt1 main-command <option-123>{, \[num <num>\]}{,{ avoid, allowable} <SomeVal>{, \[num1 <number_1>\], \[num2 <number_2>\]}{, \[num3 <number_3>\]}{, \[hide <hide>\]}}}' |
perl -ne 'BEGIN{use File::Glob ":bsd_glob"} print sort glob' 

opt1 main-command <option-123> [num <num>] allowable <SomeVal>
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [hide <hide>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [hide <hide>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [num3 <number_3>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [hide <hide>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [num3 <number_3>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num3 <number_3>]
opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal>
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [num3 <number_3>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [num3 <number_3>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num3 <number_3>]
opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal>
opt1 main-command <option-123> allowable <SomeVal> [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>]
opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [num3 <number_3>]
opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>]
opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [num3 <number_3>]
opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> allowable <SomeVal> [num3 <number_3>]
opt1 main-command <option-123> allowable <SomeVal> [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal>
opt1 main-command <option-123> avoid <SomeVal> [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>]
opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [num3 <number_3>]
opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>]
opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [num3 <number_3>]
opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
opt1 main-command <option-123> avoid <SomeVal> [num3 <number_3>]
opt1 main-command <option-123> avoid <SomeVal> [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123>
no opt1 main-command <option-123> [num <num>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal>
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [hide <hide>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] allowable <SomeVal> [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal>
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num3 <number_3>]
no opt1 main-command <option-123> [num <num>] avoid <SomeVal> [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal>
no opt1 main-command <option-123> allowable <SomeVal> [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>]
no opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [num3 <number_3>]
no opt1 main-command <option-123> allowable <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>]
no opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [num3 <number_3>]
no opt1 main-command <option-123> allowable <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> allowable <SomeVal> [num3 <number_3>]
no opt1 main-command <option-123> allowable <SomeVal> [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal>
no opt1 main-command <option-123> avoid <SomeVal> [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>]
no opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [num3 <number_3>]
no opt1 main-command <option-123> avoid <SomeVal> [num1 <number_1>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>]
no opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [num3 <number_3>]
no opt1 main-command <option-123> avoid <SomeVal> [num2 <number_2>] [num3 <number_3>] [hide <hide>]
no opt1 main-command <option-123> avoid <SomeVal> [num3 <number_3>]
no opt1 main-command <option-123> avoid <SomeVal> [num3 <number_3>] [hide <hide>]
 
Old 10-08-2018, 03:40 PM   #19
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Maybe use someone else's hard work and Not re-invent the wheel.
https://ss64.com/bash/
https://www.commandlinefu.com/commands/browse

and if-n you're bored,
https://www.commandlinefu.com/comman...-using-the-api

I've read that shit 1000 times.
I'm with astrogeek on this one.
And they are already ubiquitously "documented" IMO.

Code:
man <cmd>
apropos <cmd>
info <cmd>
whatis <cmd>
and short help
Code:
cmd -h
and long
Code:
cmd --help

All cmds on the system:
Code:
compgen -c | sort -u > commands
Now parse commands file from that. 1\2 way there!


Documented in /usr/share/man/...

Hope that helps.

Last edited by Habitual; 10-08-2018 at 03:43 PM.
 
Old 10-08-2018, 11:32 PM   #20
SomeDumbGuy
LQ Newbie
 
Registered: Sep 2018
Posts: 7

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
^ i see.
but:
each command belong to a software package and these packages most likely already contain documentation. so that's where you look first.
most likely there's a man page for each command.
or there's something in /usr/share/doc/command_package.
doc stands for documentation.
failing that, the option you're looking for is one of:
Code:
command -h
command --help
man command
# and very rarely
command -?
but still:
i fail to understand why you have to re-create this documentation when it's already there. i think you're just missing something here.
These aren't Linux commands and there isn't any documentation yet (I'm working on it).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
From the command line What is the syntax syntax to import some data into mysql table Glenn D. Linux - Software 1 03-13-2015 09:26 AM
what is the command to store a list of commands and their outputs in a file ursuniel Linux - Newbie 9 01-30-2014 03:29 PM
Create a list of date pairings based on a list of dates budgie26 Linux - General 4 05-09-2013 06:41 AM
Where do I go to get a list of the command prompt commands. dickcdavis Linux - Newbie 7 10-14-2011 09:23 AM
how execute a command in a list of commands bkcreddy17 Programming 4 06-24-2009 08:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration