I’d like to introduce a new series on CentOS Blog – CLI Tool of the Day – this series is aimed at useful command line tools that I have discovered while working with CentOS Linux systems.
To start this series off, I’d like to introduce Facter.
1. What is Facter?
Facter is small program that gathers system information such as hardware details, network settings, virtualisation type and kernel/OS information. Facter was created for Puppet to gather system information, but is also available as a standalone command.
2. What can I use Facter for?
Obvious in its description, Facter can be used to gather system information. This is very useful if you need to create a script to inventorise systems, including the hardware specification or kernel version.
3. How to Install Facter
In order to install Facter, you must first enable the EPEL repo. Once the EPEL repo is enabled, installation is simple:
yum install facter
4. Using Facter
Simply run the command below:
Sample output, with some data snipped:
<snip> id => root interfaces => eth0,lo,tun0 ipaddress => 10.0.2.1 ipaddress_eth0 => 10.0.2.1 ipaddress_lo => 127.0.0.1 ipaddress_tun0 => 172.16.14.16 is_virtual => true kernel => Linux kernelmajversion => 2.6 kernelrelease => 2.6.32-431.3.1.el6.x86_64 kernelversion => 2.6.32 macaddress => 9E:18:XX:XX:XX:XX macaddress_eth0 => 9E:18:XX:XX:XX:XX memoryfree => 379.49 MB memorysize => 525.57 MB memorytotal => 525.57 MB mtu_eth0 => 1500 mtu_lo => 16436 mtu_tun0 => 1500 netmask => 255.255.252.0 netmask_eth0 => 255.255.252.0 netmask_lo => 255.0.0.0 netmask_tun0 => 255.255.255.255 network_eth0 => 10.0.2.0 network_lo => 127.0.0.0 network_tun0 => 172.16.1.0 operatingsystem => CentOS operatingsystemrelease => 6.5 osfamily => RedHat path => /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin physicalprocessorcount => 1 processor0 => Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz processorcount => 1 ps => ps -ef rubysitedir => /usr/lib/ruby/site_ruby/1.8 <snip>