This info is kept in many places. Go into the /proc folder for example (you might need to be root in order to read the contents of files), and open any folder or file and look at the contents.
/proc/asound/cards
/proc/asound/modules
/proc/asound/version
/proc/cpuinfo
/proc/meminfo etc., etc., etc.
Some info comes from the /etc folder, some from the /usr folder and some comes from the config files in your own /home folder.
The utilities you mention gather the info and print it out for you. If you're interested in finding out exactly where each bit of info comes from, download the source code of any of the utilities and go though it line by line and see where the code takes you. I use "inxi" to print out my hardware info. Reading the code for "inxi" is easier because it's commented so thoroughly.
If you would like to look through the code of "inxi" you can obtain it with:
wget -Nc smxi.org/inxi
If you want to install it to see what it does:
Do, as root:
cd /usr/local/bin
wget -Nc smxi.org/inxi
chmod +x inxi
chmod (your_user_name) inxi
exit
Then type inxi -F in a terminal, or inxi -h if you want to see more options.