Magento 2 stores the root URLs in the database the same way as Magento 1.x.
You can get it from the command line using the following command:
mysql --host=<host> --user=<user> --password=<password> --database=<database> -e "SELECT value FROM core_config_data WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url');"
<host>
, <user>
, <password>
and <database>
are the Magento 2 database credentials, you can find them in the app/etc/env.php file