Skip to main content

Basic commands for hardware (linux)

Basic commands for hardware
by rock star devil
#rockstardevil

Code:
 lspci; lsusb; dmesg; lsmod

lspci (man page)
List all PCI devices (e.g. Internal devices).
Code:
root@kali:~# lspci 
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:10.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 01)
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:15.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:16.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:17.7 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.0 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.1 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.2 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.3 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.4 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.5 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.6 PCI bridge: VMware PCI Express Root Port (rev 01)
00:18.7 PCI bridge: VMware PCI Express Root Port (rev 01)
02:00.0 USB controller: VMware USB1.1 UHCI Controller
02:01.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
02:02.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
02:03.0 USB controller: VMware USB2 EHCI Controller
02:05.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
root@kali:~#

lsusb (man page)
List all USB devices (e.g. External devices).
Code:
root@kali:~# lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
root@kali:~#

dmesg (man page)
Displays the contents of the kernel buffer (Whats in the kernel log).
Note: Warning, this may produce a very large output
Code:
root@kali:~# dmesg 
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.12-kali1-686-pae (debian-kernel@lists.debian.org) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Debian 3.12.6-2kali1 (2014-01-06)
[    0.000000] Disabled fast string operations
...snip...
[    3.367400] EXT4-fs (sda1): re-mounted. Opts: (null)
[    3.407412] EXT4-fs (sda1): re-mounted. Opts: errors=remount-ro
[    3.499360] loop: module loaded
[    4.180582] Netfilter messages via NETLINK v0.30.
[    4.350865] pcnet32 0000:02:01.0 eth0: link up
[    5.224520] pcnet32 0000:02:05.0 eth1: link up
[    7.826665] [drm] width 1024
[    7.826704] [drm] height 768
[    7.826716] [drm] bpp 32
[    7.826771] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
[    7.843755] [drm] width 1024
[    7.843764] [drm] height 768
[    7.843771] [drm] bpp 32
[    7.843827] [drm] Fifo max 0x00200000 min 0x00001000 cap 0x0000077f
[  187.769500] sda1: WRITE SAME failed. Manually zeroing.
root@kali:~#

lsmod (man page)
Displays the status of modules in the Linux Kernel (e.g. what drivers have been loaded)
Code:
root@kali:~# lsmod 
Module                  Size  Used by
nfnetlink_log          17065  0 
nfnetlink              12853  1 nfnetlink_log
binfmt_misc            12733  1 
loop                   21962  0 
dm_crypt               22008  0 
hid_generic            12369  0 
usbhid                 39684  0 
hid                    80998  2 hid_generic,usbhid
vmw_balloon            12502  0 
psmouse                76538  0 
serio_raw              12737  0 
coretemp               12734  0 
evdev                  17172  4 
parport_pc             25991  0 
parport                35171  1 parport_pc
processor              27662  0 
battery                12949  0 
ac                     12588  0 
thermal_sys            22960  1 processor
snd_ens1371            22679  2 
snd_ac97_codec         96188  1 snd_ens1371
snd_rawmidi            22278  1 snd_ens1371
snd_seq_device         12980  1 snd_rawmidi
snd_pcm                69436  2 snd_ac97_codec,snd_ens1371
snd_page_alloc         12882  1 snd_pcm
snd_timer              22002  1 snd_pcm
vmwgfx                109623  1 
snd                    50767  10 snd_ac97_codec,snd_timer,snd_pcm,snd_rawmidi,snd_ens1371,snd_seq_device
soundcore              12890  1 snd
button                 12824  0 
ac97_bus               12462  1 snd_ac97_codec
gameport               13316  1 snd_ens1371