Linux.com

Home Linux Community Forums Linux System Administration Command Line/Scripting Ports and hardware parts names? service pci usb lsof lspci lsusb

Ports and hardware parts names? service pci usb lsof lspci lsusb

Link to this post 02 Mar 12

Here does linux generally keeps this kind of info?
I know is kept in a file somewhere...!
Where is located in Debian?

Like when you type lsof , lspci , lsusb and it shows all that info about the part / manufacturer

Especially lsof that "resolve" port service names (like ssh ... www)


Ports and hardware parts names? service pci usb lsof lspci lsusb

Link to this post 02 Mar 12

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.

Link to this post 03 Mar 12

As GoinEasy9 said, it is in a number of places, but the main one is in /proc for current systems. This is where the system registers hardware so that tools like lspci et al can easily report what the system sees, without resorting to time-consuming and error-prone physical hardware interrogation.

Link to this post 06 Mar 12

I think I didn't make myself clear...

The thing I really want to know where is the data for "resolving" port names.

Like: where lsof will go to translate "80" into "www", "22" into "ssh", and so on...

I've checked the lsof source, but didn manage to find where it pulls this info from...

Link to this post 06 Mar 12

Ah! Look in /etc/services

Link to this post 06 Mar 12

alright! thanks

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board