Posted: . At: 10:47 AM. This was 3 years ago. Post ID: 15560
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



Easily get hardware information on Ubuntu in a simple format.


It is very easy to get hardware information on Ubuntu in a simple and easy to read format.

The sudo lshw -class input command will print information about any input devices connected to your computer.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ sudo lshw -class input
  *-usb:1                   
       description: Keyboard
       product: OMEN Sequencer
       vendor: HP
       physical id: 3
       bus info: usb@3:3
       version: 0.21
       capabilities: usb-2.00
       configuration: driver=usbhid maxpower=500mA speed=12Mbit/s
  *-usb:3
       description: Mouse
       product: G502 HERO Gaming Mouse
       vendor: Logitech
       physical id: c
       bus info: usb@3:c
       version: 27.03
       serial: 017F39783637
       capabilities: usb-2.00
       configuration: driver=usbhid maxpower=300mA speed=12Mbit/s

This example will return output in HTML format.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ sudo lshw -class input -html

This nice example prints the output in Javascript Object Notation format.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ sudo lshw -class input -json
[                           
  {
    "id" : "usb:1",
    "class" : "input",
    "claimed" : true,
    "handle" : "USB:3:3",
    "description" : "Keyboard",
    "product" : "OMEN Sequencer",
    "vendor" : "HP",
    "physid" : "3",
    "businfo" : "usb@3:3",
    "version" : "0.21",
    "configuration" : {
      "driver" : "usbhid",
      "maxpower" : "500mA",
      "speed" : "12Mbit/s"
    },
    "capabilities" : {
      "usb-2.00" : "USB 2.0"
    }
  },
  {
    "id" : "usb:3",
    "class" : "input",
    "claimed" : true,
    "handle" : "USB:3:5",
    "description" : "Mouse",
    "product" : "G502 HERO Gaming Mouse",
    "vendor" : "Logitech",
    "physid" : "c",
    "businfo" : "usb@3:c",
    "version" : "27.03",
    "serial" : "017F39783637",
    "configuration" : {
      "driver" : "usbhid",
      "maxpower" : "300mA",
      "speed" : "12Mbit/s"
    },
    "capabilities" : {
      "usb-2.00" : "USB 2.0"
    }
  }
]

List all of the RAM and memory in your machine.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ sudo lshw -businfo | grep GiB

This lists all RAM sticks as well as all hard disk drives that are installed. A very useful command.

Use this example to get network devices information, but strip out serial numbers and other information. This would be useful for sharing on a forum for example.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ sudo lshw -class network -sanitize

This is a way to find out when you logged into your Linux machine.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ lslogins | grep $LOGNAME | awk '{ print $4 }'
07:15

That could be useful.

Finally, this is the systemd-analyze utility, this prints the time taken by the system to boot.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ systemd-analyze
Startup finished in 4.312s (kernel) + 2min 341ms (userspace) = 2min 4.653s 
graphical.target reached after 2min 299ms in userspace

If you use the blame parameter, this will list the process started by the system upon booting and they will be ranked by the time taken for them to run.

┌──[jason@11000000.10101000.00000001.00000011][~]
└──╼  ╼ $ systemd-analyze blame | head -n 20
1min 3.226s plymouth-quit-wait.service                                         
    17.647s NetworkManager-wait-online.service                                 
    17.043s systemd-journal-flush.service                                      
    14.785s snapd.seeded.service                                               
    13.338s snapd.service                                                      
    13.298s tor@default.service                                                
    10.233s postfix@-.service                                                  
    10.133s systemd-udev-settle.service                                        
    10.105s dev-sdd1.device                                                    
    10.013s apache2.service                                                    
     9.440s polkit.service                                                     
     9.428s networkd-dispatcher.service                                        
     9.253s avahi-daemon.service                                               
     9.237s NetworkManager.service                                             
     9.198s switcheroo-control.service                                         
     8.607s thermald.service                                                   
     8.605s systemd-logind.service                                             
     8.556s wpa_supplicant.service                                             
     8.026s ssh.service                                                        
     7.058s rsyslog.service

You may then see if an unneeded process is slowing the system boot down. But if I had an SSD, it would be a lot faster. Not too bad though.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.