db2ls - List installed Db2 products and features command

Lists the Db2 products and features installed on your Linux® and UNIX systems, including the Db2 HTML documentation.

With the ability to install multiple copies of Db2 products on your system and the flexibility to install Db2 products and features in the path of your choice, you can use the db2ls command to list:
  • where Db2 products are installed on your system and list the Db2 product level.
  • all or specific Db2 products and features in a particular installation path.

The db2ls command can be found both in the installation media and in a Db2 install copy on the system. The db2ls command can be run from either location. The db2ls command can be run from the installation media for all products except IBM® Data Server Driver Package.

Authorization

None

Required Connection

None

Command syntax

Read syntax diagramSkip visual syntax diagramdb2ls-q-ffeature-rsp-file-ID-a-p-bbase-install-path-c-llog-file

Command parameters

-q
Signifies that the query is to list installed Db2 products and features. By default, only the visible components (features) are displayed unless the -a parameter is also specified.
-f feature-rsp-file-ID
Queries for the specific feature, if it is installed. If it is not installed, the return code from the program is nonzero, otherwise the return code is zero.
-a
Lists all hidden components as well as visible features. The db2ls command only lists visible features by default.
-p
Lists products only. This will give a brief list of which products the customer has installed rather than listing the features.
-b base-install-path
When using the global db2ls command in /usr/local/bin, you need to specify which directory you are querying. The global db2ls command will simply call the db2ls from that install path and pass in the rest of the parameters.
-c
Prints the output as a colon-separated list of entries rather than column-based. This allows you to programmatically with this information. The first line of output will be a colon-separated list of tokens to describe each entry. This first line will start with a hash character ("#") to make it easy to ignore programmatically.
-l log-file
Trace log file to use for debugging purposes.

Examples

  • To query what Db2 database features are installed to a particular path, issue:
    db2ls -q -b /opt/ibm/ese/11.1
  • To see all Db2 database features installed to a particular path, issue:
    db2ls -q -a -b /opt/ibm/ese/11.1
  • To check whether a specific Db2 database feature is installed or not, issue:
    db2ls -q -b /opt/ibm/ese/11.1 -f feature

Usage notes

  • You cannot use the db2ls command on Windows operating systems.
  • If the root has write permission in /usr/local/bin or is able to create /usr/local/bin, the symbolic link /usr/local/bin/db2ls will be created which points to DB2DIR/install/db2ls for the first installation of Db2 Version 9 or later version installed on the system. The root will update the link pointing to the highest version and level of Db2 installed on the system, if multiple copies of Db2 are installed.
    A non-root installation will not create or change the /usr/local/bin/db2ls. In that case, to run db2ls, you have to do one of two things:
    • Add inst_home/sqllib/install to the user's path. Then you can run db2ls as the non-root user.
    • Pass in the exact path of the command, for example inst_home/sqllib/install/db2ls.
  • The db2ls command is the only method to query a Db2product at Version 9 or later. You cannot query Db2 products using Linux or UNIX operating system native utilities such as pkgadd, rpm, SMIT, or swinstall. Any existing scripts containing a native installation utility that you use to interface and query with Db2 installations will need to change.
  • Different feature listings are obtained depending upon the root versus non-root method of Db2 installation and the user running the command.

    Without the -q option:

    • For any user, other than the non-root-install instance user, the command displays all copies installed by the root user.
    • For the non-root-install instance user, the command displays all Db2 copies installed by the root user plus the non-root copy owned by the non-root user.

    With the -q option:

    • If userA wants to know if userB has Db2 installed, userA can run db2ls -q -b $userBHomeDir/sqllib. If userA has access permission, then the Db2 features installed by userB will be displayed, otherwise, an error message will be returned indicating that access permission was denied.
    • If you run db2ls -q without the -b option, the installed features in the install path where db2ls belongs are displayed.
  • If the directory is read-only, the db2ls command cannot be linked to from the /usr/local/bin directory. If you are running in a system workload partitions (WPARs) you can use the db2ls command located in the installation image root directory to query a list of installed copies.