Configure the system such that the command db2ls -- which shows basic information about known Db2 copies installed on the system -- uses the executable that is part of a Db2 copy that is at the highest version. The db2greg command -- which shows information form the Db2 global registry -- is one method of displaying the version of installed copies. The lines
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5,,,0,0,,1609285017,0
...
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_01,,,0,0,,1610327461,0
...
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_03,-,,0,,,1611448740,0
...
in the following listing, which shows the output of the db2reg command, displays the versions and installation paths of the copies. In each line above the third comma-separated field is the version and the fourth field is the path. In this case all three copies are at version 11.5.5.0.
root@u1804-lab:~# db2greg -dump
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5,,,0,0,,1609285017,0
V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5,
I,DB2,11.5.5.0,db2inst1,/home/db2inst1/sqllib,,1,0,/opt/ibm/db2/V11.5,,
S,TSA,4.1.0.5,/opt/IBM/tsamp,DG_NOT_ALLOWED,DB2_INSTALLED,0,0,-,1610327432,0
S,RSCT,3.2.4.4,/usr/sbin/rsct,DG_NOT_ALLOWED,DB2_INSTALLED,0,0,-,1610327432,0
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_01,,,0,0,,1610327461,0
V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5_01,
I,DB2,11.5.5.0,db2inst2,/home/db2inst2/sqllib,,1,0,/opt/ibm/db2/V11.5_01,,
S,DB2,11.5.5.0,/opt/ibm/db2/V11.5_03,-,,0,,,1611448740,0
V,DB2GPRF,DB2SYSTEM,u1804-lab,/opt/ibm/db2/V11.5_03,
I,DB2,11.5.5.0,db2inst3,/home/db2inst3/sqllib,,1,0,/opt/ibm/db2/V11.5_03,,
Since all versions are 11.5.5.0, this step is not necessary in this case, but if they were different, it would be necessary to ensure that the symbolic link /usr/local/bin/db2ls points to the executable db2ls contained in the installation directory of a copy with the highest version. In the listing below, the symbolic link is to a db2ls in the install directory under the installation path of the first copy installed on the system.
root@u1804-lab:~# ls -l /usr/local/bin | grep db2ls
lrwxrwxrwx 1 root root 32 Jan 10 20:11 db2ls -> /opt/ibm/db2/V11.5/install/db2ls
If this installation directory were for a copy of Db2 lower than any other version the link would have to be adjusted.