The command to check usb devices in Linux Ubuntu. You can easily list usb devices in Linux command line or list usb devices in Linux TTY.
This post describes how to find the /dev name of my USB device. By default, when a storage devices is plugged into the system, it mount automatically in the /media/ directory.
Detect USB Devices – Find USB Device Name
There are many ways to get the info about USB device and find the name of USB device connected to the system. Before we begin, you must know about the following two basic commands:
1.To see a list of your USB devices (the vendor and device ID’s), run:
lsusb
2. To see information about currently mounted systems, simply run:
mount
1. fdisk
fdisk is a disk partition manipulation program, which allows you to create, destroy, resize, move and copy partitions on a hard drive using a menu-driven interface. It is useful for organising the disk space on a new drive, reorganising an old drive, creating space for new operating systems, and copying data to new hard disks. fdisk prints the partition table including any USB drive if present:
sudo fdisk -l
The argument -l, –list shows the partition table on the specified device and exits. If there is no device specified, lists the partition tables on all detected devices. Another argument -s, –size=DEVICE prints the size of the partition on DEVICE is printed on the standard output.
2. dmesg
dmesg is used to examine or control the kernel ring buffer. The default action is to display all messages from the kernel ring buffer.
dmesg is an important command that prints or controls the kernel ring buffer, a data structure which stores information about the kernel’s operations.
dmesg
When we use the command dmesg with argument -L it colorize the output.
3. lsblk
lsblk is another command to find the USB device name. The lsblk command lists all the block devices that are attached to the system. lsblk lists information about all available or the specified block devices. The lsblk command reads the sysfs filesystem and udev db to gather information. The command prints all block devices (except RAM disks) in a tree-like format by default. Use lsblk –help to get a list of all available columns.
lsblk
If you want to list empty devices also, run the command with -a, –all argument. By default the lsblk command doesn’t show empty devices.
You can also use df command to check the Linux disk space utilization alongwith the device name. df displays the amount of disk space available on the file system containing each file name argument. If no file name is given, the space available on all currently mounted file systems is shown.