Find Detailed Information for Fibre HBAs in Linux

If you're trying to connect a Linux host to a Fibre Channel network, you'll probably need to find your World Wide Names (WWNs) at some point.  On most Linux distributions, this can be done with the following command:

cat /sys/class/scsi_host/host(x)/device/fc_host/host(x)/port_name

Swap (x) with the appropriate host number.  If you only have a single host, your number is 0.  As such, the command will look like this:

cat /sys/class/scsi_host/host0/device/fc_host/host0/port_name


On some distributions (such as Red Hat Enterprise Linux), you can save time by dropping the /scsi_host/host0/device portion, leaving you with a shorter command:

cat /sys/class/fc_hosts/host0/port_name