<h3>Introduction</h3><p>In this guide, I will show you how to list the devices, drives, <a href="https://www.lifewire.com/what-is-pci-2640242" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="1">PCI devices</a> and <a href="https://www.lifewire.com/universal-serial-bus-usb-2626039" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="2">USB devices</a> on your computer.</p><p>For finding out which drives are available you will briefly be shown how to show the mounted devices and then you will be shown how to show all the drives.</p><h3>Use The Mount Command</h3><p>In a previous guide, I showed <a href="https://www.lifewire.com/how-to-mount-dvds-and-cd-roms-using-ubuntu-4075034" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="3">how to mount devices using Linux</a>. Now I will show you how to list the mounted devices.</p><p>The most simple syntax you can use is as follows:</p><blockquote><p>mount</p></blockquote><p>The output from the above command is fairly verbose and will be something like this:</p><blockquote><p>/dev/sda4 on / type ext4 (rw,relatime,errors&#61;remount-ro,data&#61;ordered)<br/><br/>securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relat<br/>ime)</p><p> </p></blockquote><p>There is so much information that it really isn&#39;t that easy to read.</p><p>Hard drives generally start with /dev/sda or /dev/sdb so you can use <a href="https://www.lifewire.com/linux-grep-command-3571842" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="4">the grep command</a> to reduce the output as follows:</p><blockquote><p>mount | grep /dev/sd</p></blockquote><p>The results this time will show something like this:</p><blockquote><p>/dev/sda4 on / type ext4 (rw,relatime,errors&#61;remount-ro,data&#61;ordered)<br/><br/>/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask&#61;0077,dmask&#61;0077,codepage&#61;437,iocharset&#61;iso8859-1,shortname&#61;mixed,errors&#61;remount-ro)</p></blockquote><p>This doesn&#39;t list out your drives but it does list out your mounted partitions. It doesn&#39;t list partitions that aren&#39;t yet mounted.</p><p>The device /dev/sda usually stands for hard drive 1 and if you have a second hard drive then it will be mounted to /dev/sdb. If you have an <a href="https://www.lifewire.com/solid-state-hybrid-drive-833451" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="5">SSD</a> then this will likely be mapped to /dev/sda and the hard drive mapped to /dev/sdb.</p><p>As you can see my computer has a single /dev/sda drive with 2 partitions mounted. The /dev/sda4 partition has an ext4 filesystem and it is where Ubuntu is installed. The /dev/sda1 is the <a href="https://www.lifewire.com/efi-file-2620983" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="6">EFI</a> partition used to boot the system in the first place.</p><p>This computer is set up to <a href="http://www.everydaylinuxuser.com/2015/11/how-to-install-ubuntu-linux-alongside.html" data-component="link" data-source="inlineLink" data-type="externalLink" data-ordinal="7" rel="nofollow">dual boot with Windows 10</a>. In order to see the Windows partitions, I will need to mount them.</p><h3>Use lsblk To List Block Devices</h3><p>Mount is OK for listing mounted devices but it doesn&#39;t show every device you have and the output is very verbose making it difficult to read.</p><p>The best way to list out the drives in Linux is to use lsblk as follows:</p><blockquote><p>lsblk</p></blockquote><p>The information is displayed in a tree format with the following information:</p><ul><li>Name</li><li>Major Minor version number</li><li>Is it removable</li><li>Size</li><li>Is it readonly</li><li>Is it a disk or a partition</li><li>Where is the partition mounted</li></ul><p>The display looks something like this:</p><ul><li>sda - 8.0 - 0 - 931 GB - 0 - disk <ul><li>sda1 - 8.1 - 0 - 500M - 0 - part - /boot/efi</li><li>sda2 - 8.2 - 0 - 128M - 0 - part</li><li>sda3 - 8.3 - 0 - 370.6 G - 0 - part </li><li>sda4 - 8.4 - 0 - 554.4 G - 0 - part /</li><li>sda5 - 8.5 - 0 - 5.9G - 0 - part - [SWAP]</li></ul></li><li>sr0 - 11:0 - 1 - 1024M - 0 - rom</li></ul><p>The information is much easier to read. You can see that I have one drive called sda which has 931 gigabytes. SDA is split into 5 partitions 2 or which are mounted and a third which is assigned to swap.</p><p>There is also a drive called sr0 which is the built-in DVD drive.</p><h3>How To List PCI Devices</h3><p>One thing that it is really worth learning about Linux is that if you want to list anything then there is usually a command which starts with the letters &#34;ls&#34;.</p><p>You have already seen that &#34;lsblk&#34; lists out block devices and can be used to show the way disks are laid out.</p><p>You should also know that <a href="https://www.lifewire.com/uses-of-linux-ls-command-4054227" data-component="link" data-source="inlineLink" data-type="internalLink" data-ordinal="8">the ls command</a> is used to get a directory listing.</p><p>Later on, you will use the lsusb command to list out the USB drives on the computer.</p><p>You can also list out devices by using the lsdev command but you will need to make sure procinfo is installed in order to use that command.</p><p>To list out the PCI devices use the lspci command as follows:</p><blockquote><p>lspci</p></blockquote><p>The output from the above command is again very verbose meaning you probably get more information than you bargained for.</p><p>Here is a short snapshot from my listing:</p><blockquote><p>00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Grap<br/>hics Controller (rev 09)<br/><br/>00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family US<br/>B xHCI Host Controller (rev 04)<br/> </p></blockquote><p>The listing lists everything from VGA controllers to USB, sound, Bluetooth, wireless and ethernet controllers.</p><p>Ironically the standard lspci listing is considered basic and if you want more detailed information about each device you can run the following command:</p><blockquote><p>lspci -v</p></blockquote><p>The information for each device looks something like this:</p><blockquote><p>02:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)<br/> Subsystem: Dell AR9485 Wireless Network Adapter<br/> Flags: bus master, fast devsel, latency 0, IRQ 17<br/> Memory at c0500000 (64-bit, non-prefetchable) [size&#61;512K]<br/> Expansion ROM at c0580000 [disabled] [size&#61;64K]<br/> Capabilities:<br/> Kernel driver in use: ath9k<br/> Kernel modules: ath9k</p></blockquote><p>The output from the lspci -v command is actually more readable and you can clearly see that I have a Qualcomm Atheros wireless card.</p><p>You can get even more verbose output by using the following command:</p><blockquote><p>lspci -vv</p></blockquote><p>If that isn&#39;t enough try the following:</p><blockquote><p>lspci -vvv</p></blockquote><p>And if that isn&#39;t enough. No, I&#39;m only kidding. It stops there.</p><p>The most useful aspect of lspci other than listing out devices is the kernel driver that is used for that device. If the device isn&#39;t working it is possibly worth researching whether there is a better driver available for the device.</p><h3>List The USB devices Attached To The Computer</h3><p>To list out the USB devices available for your computer use the following command:</p><blockquote><p>lsusb</p></blockquote><p>The output will be something like this:</p><blockquote><p>Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub<br/>Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br/>Bus 001 Device 005: ID 0c45:64ad Microdia<br/>Bus 001 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller<br/>Bus 001 Device 007: ID 0cf3:e004 Atheros Communications, Inc.<br/>Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub<br/>Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub<br/>Bus 004 Device 002: ID 0bc2:231a Seagate RSS LLC<br/>Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub<br/>Bus 003 Device 002: ID 054c:05a8 Sony Corp.<br/>Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub</p></blockquote><p>If you insert a USB device into the computer such as an external hard drive and then run the lsusb command you will see the device appear in the list.</p><p>For example, I have inserted a Seagate external hard drive which is appearing at BUS 004 Device 2 and I have inserted a Sony Walkman (no not the cassette player from the 1980s) and this appears at Bus 003 Device 002.</p><h3>Summary</h3><p>To summarize then, the best way to list anything out in Linux is to remember the following ls commands:</p><ul><li>ls - list files in the file system</li><li>lsblk - list the block devices (i.e. drives)</li><li>lspci - list the pci devices</li><li>lsusb - list the USB devices</li><li>lsdev - list all the devices</li></ul>