Command line tools available by default In a unix based system a number of commands are available by default (either in /bin or /usr/bin). Suppose in some time I installed more tools like git, svn … 

In OS X if I install XCode and then the command line tools package, a bundle of development tools will be getting installed into the system. So how can I know which commands are available at the time of the installation of the OS?

Is netcat, nc available by default on Mac OSX or is that installed along with command line tools ?
So how can I know which commands are available at the time of installation?

Commands available after a fresh install of Mavericks (OS X 10.9) belong to one of these four packages:


com.apple.pkg.BSD
com.apple.pkg.BaseSystemBinaries
com.apple.pkg.BaseSystemResources
com.apple.pkg.Essentials


(Note that, as of High Sierra (macOS 10.13), commands have moved to this package com.apple.pkg.Core.)

You can list the commands included in every package with this command:

pkgutil --files &lt;package name&gt; | egrep '^usr/s*bin|^s*bin/'


Are netcat, nc available by default on Mac OS X or is that installed along with command line tools?

I found nc with:

pkgutil --files com.apple.pkg.BaseSystemBinaries | egrep '^usr/bin/nc'


(On High Sierra, run pkgutil --files com.apple.pkg.Core | egrep '^usr/bin/nc' instead.)

so yes, nc belongs to the base OS installation.

I couldn't find netcat, so if you have it on your system it was installed later.



To list all commands provided by all packages, run in Terminal:

for p in $(pkgutil --packages); do 
  list_of_cmds=$(pkgutil --files $p | egrep '^usr/s*bin|^s*bin/')
  if [ ! -z "$list_of_cmds" ]; then
    echo "&gt;&gt;&gt;&gt; $p &lt;&lt;&lt;&lt;"
    echo "$list_of_cmds"
  fi
done


You can also pipe the command to a file on your Desktop for later reference:

for p in $(pkgutil --packages); do 
  list_of_cmds=$(pkgutil --files $p | egrep '^usr/s*bin|^s*bin/')
  if [ ! -z "$list_of_cmds" ]; then
    echo "&gt;&gt;&gt;&gt; $p &lt;&lt;&lt;&lt;"
    echo "$list_of_cmds"
  fi
done &gt; ~/Desktop/cmds_from_pkgs.txt