LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Listing all the commands (https://www.linuxquestions.org/questions/linux-newbie-8/listing-all-the-commands-670701/)

IshanJ 09-17-2008 10:57 PM

Listing all the commands
 
I want to know if there is a single command to list down all the commands of linux:study:?

klearview 09-17-2008 11:06 PM

There is no such thing as 'all commands of linux'. It depends what programs you have installed on your system - for example piping output to ubiquitous 'less' is not gonna give any results if 'less' is not installed. If you are looking for shell built-ins - again that will depend on which shell is installed. For Bash you can do 'man builtins'

i92guboj 09-17-2008 11:08 PM

Quote:

Originally Posted by IshanJ (Post 3283911)
I want to know if there is a single command to list down all the commands of linux:study:?

That's going to be hard to find. It really depends on what your distro installed, and the options you made when installing. However, most of them will be under /bin and /usr/bin, more important ones which are only usable by the superuser, will be found on /sbin and /usr/sbin. You can list the contents of this directories with ls, of explore them with your explorer of choice.

Then launch "man <whatever command>" to read info about that command.

Besides that, there are also builtin command on each shell. Most distros use bash as the default shell, but there are many others, and all are different in one or another way.

Mr. C. 09-17-2008 11:19 PM

If you are running bash, hit Tab Tab and bash will ask you if you want to list all the commands that are currently executable by you.

pixellany 09-17-2008 11:36 PM

cd /usr/man
then enter:

for dir in `ls|egrep "man[[:digit:]]"`;do ls $dir|sed 's/\..*$//';done

12087 entries on my system......but WHY???

Perhaps you did not mean ALL.....;)
Any good Linux book will give you the most common ones---eg the Advanced Bash Scripting Guide--free at http://tldp.org

pixellany 09-17-2008 11:39 PM

Quote:

Originally Posted by Mr. C. (Post 3283929)
If you are running bash, hit Tab Tab and bash will ask you if you want to list all the commands that are currently executable by you.

Hmmmm......my system gives 3521. That leaves 8566 commands that have man pages, but that I cannot use.
I'm getting a headach....;)

ghostdog74 09-18-2008 12:00 AM

commands as in executables?
Code:

find / -type f  | xargs -i file -N "{}" | grep -i executable | cut -d":" -f1

i92guboj 09-18-2008 12:17 AM

Quote:

Originally Posted by pixellany (Post 3283945)
cd /usr/man
then enter:

for dir in `ls|egrep "man[[:digit:]]"`;do ls $dir|sed 's/\..*$//';done

12087 entries on my system......but WHY???

Perhaps you did not mean ALL.....;)
Any good Linux book will give you the most common ones---eg the Advanced Bash Scripting Guide--free at http://tldp.org

That's got the price to the worst measure method ever :p
  • First, there are lots of commands that do not have a man page.
  • To follow with, some others do have many.
  • And to finish with, man pages are not just for commands. Almost any configuration file out there has it's own man page, C functions has also their own man page, and so on. You probably want to stick to the man1 and man8 subdirs only, since those will be the only sections containing man pages for real commands. Still, it would be way too inaccurate. Some systems might not even have most man pages installed unless you manually install them.

If you want to see binary files, look into the bin directories, it's easier and there's no error margin there. The tab completion will also work ok, since what we consider "commands" are always either in our path or as builtins.

This would be a more accurate (still, not perfect) measure:

Code:

find {/usr/sbin,/sbin,/usr/bin,/bin} -perm 755 -type f | wc -l

jschiwal 09-18-2008 12:34 AM

Just an FYI. There are a number of man pages for configuration files and if installed linux and posix system calls. For example, smb.conf has a man page. You may have a number of manpages in /usr/share/man/man1/ which cover linux c library routines. /usr/share/man/man3p/ have posix library routines which are a part of the Posix Programming Manual. So you probably have a lot more man pages then programs.

About 100 of the most common commands are supplied by the coreutils package. You can find documentation for them in the "info coreutils" manual.

Most programs will be installed in /bin, /sbin/, /usr/bin/, /usr/sbin/. The ones in an sbin dir are administrative commands and are usually not in a regular users path. I'm not counting Java programs. Java may install it's own java applications in a java directory hierarchy and add a directory to your path. If you add a non-regular version of kde or gnome, it may be installed under /opt/ which will include a full hierarchy such as bin/, sbin/ and lib/.

Mr. C. 09-18-2008 12:47 AM

Quote:

Originally Posted by pixellany (Post 3283949)
Hmmmm......my system gives 3521. That leaves 8566 commands that have man pages, but that I cannot use.
I'm getting a headach....;)

My more sane BSD system has a mere 1228. The OP asked for a full list - the headache belongs to the requester.

chrism01 09-18-2008 02:24 AM

In addition to tldp above, this is a good guide: http://rute.2038bug.com/index.html.gz

pixellany 09-18-2008 08:00 AM

I confess---I went off on a bit of a tangent. (And I forgot that config files also have man pages).

My main point--perhaps too subtle--is that you really don't want/need to know every single command.

jschiwal 09-18-2008 10:26 PM

Besides regular commands, I must confess that I probably have kde apps and libraries I've installed using the package manager and have never gotten around to trying them out.


All times are GMT -5. The time now is 03:17 PM.