Ubuntu is the best given the amount of searchable Ubuntu content on the internet. If Google is your guru till you get one, then Ubuntu is the way to go.
Having said that, i strongly advise using VirtualBox - so that you can test any of the distributions you want to inside your base distro.
Since you want to learn command line operations, using virtualization, you can mess around and happily spoil everything in the virtual machine and emerge unscathed, keeping you main system untouched.
This particular quality of virtualization will save you a ton of headaches.
If learning linux command line, never proceed outside of a virtual machine.
Just for sake of completeness, if your use is the opposite, that is, a stable GUI desktop OS, I suggest PCLinuxOS due to the friendly community.
They're the most newbie-friendly forums on Linux on the web.
And don't use the command-line in PCLinuxOS to install anything.
It depends on how the application is build. One problem can be system paths that might differ from distribution to distribution. Another problem are shared libraries which might not be installed on the target system, or worse might be installed in incompatible versions.
One solution to the libraries problem is to either build statically linked binaries or (like it's common on OS X) to just ship all required libs with the application and if necessary set LD_LIBRARY_PATH accordingly (though this is a bad idea for so many reasons).
An easy way to check if your program will run is to list all the linked libraries using ldd and see if they exist on the target system.
Example using apache httpd:
[lukas@web1 /]$ ldd /usr/sbin/httpd
libm.so.6 => /lib64/libm.so.6 (0x00002b1ec3aaf000)
libpcre.so.0 => /lib64/libpcre.so.0 (0x00002b1ec3d32000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00002b1ec3f4e000)
libaprutil-1.so.0 => /usr/lib64/libaprutil-1.so.0 (0x00002b1ec4167000)
libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00002b1ec4384000)
libldap-2.3.so.0 => /usr/lib64/libldap-2.3.so.0 (0x00002b1ec45bc000)
liblber-2.3.so.0 => /usr/lib64/liblber-2.3.so.0 (0x00002b1ec47f7000)
libdb-4.3.so => /lib64/libdb-4.3.so (0x00002b1ec4a05000)
libexpat.so.0 => /lib64/libexpat.so.0 (0x00002b1ec4cfa000)
libapr-1.so.0 => /usr/lib64/libapr-1.so.0 (0x00002b1ec4f1d000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b1ec5144000)
libdl.so.2 => /lib64/libdl.so.2 (0x00002b1ec535f000)
libc.so.6 => /lib64/libc.so.6 (0x00002b1ec5564000)
libsepol.so.1 => /lib64/libsepol.so.1 (0x00002b1ec58bb000)
/lib64/ld-linux-x86-64.so.2 (0x00002b1ec3892000)
libuuid.so.1 => /lib64/libuuid.so.1 (0x00002b1ec5b01000)
libpq.so.4 => /usr/lib64/libpq.so.4 (0x00002b1ec5d06000)
libsqlite3.so.0 => /usr/lib64/libsqlite3.so.0 (0x00002b1ec5f28000)
libresolv.so.2 => /lib64/libresolv.so.2 (0x00002b1ec6183000)
libsasl2.so.2 => /usr/lib64/libsasl2.so.2 (0x00002b1ec6399000)
libssl.so.6 => /lib64/libssl.so.6 (0x00002b1ec65b2000)
libcrypto.so.6 => /lib64/libcrypto.so.6 (0x00002b1ec67fc000)
libkrb5.so.3 => /usr/lib64/libkrb5.so.3 (0x00002b1ec6b4e000)
libnsl.so.1 => /lib64/libnsl.so.1 (0x00002b1ec6de3000)
libgssapi_krb5.so.2 => /usr/lib64/libgssapi_krb5.so.2 (0x00002b1ec6ffc000)
libcom_err.so.2 => /lib64/libcom_err.so.2 (0x00002b1ec722a000)
libk5crypto.so.3 => /usr/lib64/libk5crypto.so.3 (0x00002b1ec742c000)
libz.so.1 => /usr/lib64/libz.so.1 (0x00002b1ec7652000)
libkrb5support.so.0 => /usr/lib64/libkrb5support.so.0 (0x00002b1ec7866000)
libkeyutils.so.1 => /lib64/libkeyutils.so.1 (0x00002b1ec7a6e000)
If all the linked libraries exist in a compatible version on the target system, it's likely your application will be able to start. From there on it's mostly paths that have to be adjusted.
Best Answer
Centos is basically RHEL recompiled from scratch, and i believe their version numbers are identical to their RHEL counterparts - Its commonly used as a replacement for RHEL. You might also want to consider scientific linux, which is another RHEL derivative, and is almost identical.
RHEL has archives of quite a few versions in the 5.x family, while SL has 5.7