xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

How to check the USB devices connected to Linux by using Terminal All In One

How to check the USB devices connected to Linux by using Terminal All In One

Raspberry Pi 3 B

# ✅
$ lsusb
Bus 001 Device 004: ID 2e8a:0005  
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

# Kingston 8 GB U 盘

$ lsusb
Bus 001 Device 006: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102/2.0 / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick
Bus 001 Device 005: ID 2e8a:0005  
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

image

$ df -h
文件系统        容量  已用  可用 已用% 挂载点
/dev/root        29G  6.4G   22G   23% /
devtmpfs        243M     0  243M    0% /dev
tmpfs           248M     0  248M    0% /dev/shm
tmpfs           248M  6.6M  241M    3% /run
tmpfs           5.0M  4.0K  5.0M    1% /run/lock
tmpfs           248M     0  248M    0% /sys/fs/cgroup
/dev/mmcblk0p1  253M   51M  202M   21% /boot
tmpfs            50M     0   50M    0% /run/user/1000

$ df -Th
文件系统       类型      容量  已用  可用 已用% 挂载点
/dev/root      ext4       29G  6.4G   22G   23% /
devtmpfs       devtmpfs  243M     0  243M    0% /dev
tmpfs          tmpfs     248M     0  248M    0% /dev/shm
tmpfs          tmpfs     248M  6.6M  241M    3% /run
tmpfs          tmpfs     5.0M  4.0K  5.0M    1% /run/lock
tmpfs          tmpfs     248M     0  248M    0% /sys/fs/cgroup
/dev/mmcblk0p1 vfat      253M   51M  202M   21% /boot
tmpfs          tmpfs      50M     0   50M    0% /run/user/1000

image

# ❌
$ df -Th | grep media

# ✅
$ lsblk | grep sd

image

# ✅
$ sudo blkid

# ✅
$ sudo fdisk -l
# ✅
$ dmesg | grep usb

# ✅
$ dmesg | less

image

# ✅
$ usb-devices

image

macOS

  1. system reports / system informations

image

  1. command line
$  lsusb
zsh: command not found: lsusb
# ✅
$ ioreg -p IOUSB

+-o Root  <class IORegistryEntry, id 0x100000100, retain 25>
  +-o AppleUSBVHCIBCE Root Hub Simulation@80000000  <class AppleUSBRootHubDevice, id 0x10000050b, re$
  | +-o Apple T2 Controller@80100000  <class AppleUSBDevice, id 0x10000050d, registered, matched, ac$
  | +-o Headset@80200000  <class AppleUSBDevice, id 0x100000515, registered, matched, active, busy 0$
  +-o AppleUSBXHCI Root Hub Simulation@00000000  <class AppleUSBRootHubDevice, id 0x10000052b, regis$
  | +-o USB3.0 Hub@00200000  <class AppleUSBDevice, id 0x10000052d, registered, matched, active, bus$
  +-o AppleUSBXHCI Root Hub Simulation@14000000  <class AppleUSBRootHubDevice, id 0x100000544, regis$
    +-o USB2.0 Hub@14400000  <class AppleUSBDevice, id 0x100000546, registered, matched, active, bus$
    | +-o USB DEVICE@14420000  <class AppleUSBDevice, id 0x10005610c, registered, matched, active, b$
    +-o USB Receiver@14300000  <class AppleUSBDevice, id 0x100000557, registered, matched, active, b$
    +-o USB 2.0 BILLBOARD             @14100000  <class AppleUSBDevice, id 0x10000056e, registered, $
➜  ~ 

image

# ✅
$ system_profiler SPUSBDataType

2023-03-31 16:30:29.258 system_profiler[85609:37436029] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2023-03-31 16:30:29.260 system_profiler[85609:37436029] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2023-03-31 16:30:29.261 system_profiler[85609:37436029] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
USB:

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCITR
      PCI Device ID: 0x15ec 
      PCI Revision ID: 0x0006 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x00 

        USB3.0 Hub:

          Product ID: 0x0612
          Vendor ID: 0x05e3  (Genesys Logic, Inc.)
          Version: 92.24
          Speed: Up to 5 Gb/s
          Manufacturer: GenesysLogic
          Location ID: 0x00200000 / 1
          Current Available (mA): 900
          Current Required (mA): 0
          Extra Operating Current (mA): 0

    USB 3.1 Bus:

      Host Controller Driver: AppleUSBXHCITR
      PCI Device ID: 0x15ec 
      PCI Revision ID: 0x0006 
      PCI Vendor ID: 0x8086 
      Bus Number: 0x01 

    USB 3.1 Bus:

      Host Controller Driver: AppleIntelCNLUSBXHCI
      PCI Device ID: 0xa36d 
      PCI Revision ID: 0x0010 
      PCI Vendor ID: 0x8086 

        USB2.0 Hub:

          Product ID: 0x0610
          Vendor ID: 0x05e3  (Genesys Logic, Inc.)
          Version: 92.24
          Speed: Up to 480 Mb/s
          Manufacturer: GenesysLogic
          Location ID: 0x14400000 / 2
          Current Available (mA): 500
          Current Required (mA): 100
          Extra Operating Current (mA): 0

            USB DEVICE:

              Product ID: 0x4016
              Vendor ID: 0x24ae
              Version: 1.11
              Speed: Up to 12 Mb/s
              Manufacturer: SONiX
              Location ID: 0x14420000 / 9
              Current Available (mA): 500
              Current Required (mA): 100
              Extra Operating Current (mA): 0

        USB Receiver:

          Product ID: 0xc52f
          Vendor ID: 0x046d  (Logitech Inc.)
          Version: 30.00
          Speed: Up to 12 Mb/s
          Manufacturer: Logitech
          Location ID: 0x14300000 / 3
          Current Available (mA): 500
          Current Required (mA): 98
          Extra Operating Current (mA): 0

        USB 2.0 BILLBOARD             :

          Product ID: 0x0100
          Vendor ID: 0x2109  (VIA Labs, Inc.)
          Version: 3.00
          Serial Number: 0000000000000001
          Manufacturer: VIA Technologies Inc.         
          Location ID: 0x14100000

    Apple T2 Bus:

      Host Controller Driver: AppleUSBVHCIBCE

        Headset:

          Product ID: 0x8103
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.05
          Serial Number: 000000000000
          Manufacturer: Apple
          Location ID: 0x80200000

        Apple T2 Controller:

          Product ID: 0x8233
          Vendor ID: 0x05ac (Apple Inc.)
          Version: 2.01
          Serial Number: 0000000000000000
          Manufacturer: Apple Inc.
          Location ID: 0x80100000

# ✅
$ diskutil list external

/dev/disk2 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *7.9 GB     disk2
   1:             Windows_FAT_32 NO NAME                 7.9 GB     disk2s1

image

# devices => /dev/ ✅
$ ls /dev

$ ls -alth /dev | grep disk

image

# disk free ✅
$ df -h

Filesystem       Size   Used  Avail Capacity iused     ifree %iused  Mounted on
/dev/disk1s5s1  233Gi   11Gi   90Gi    11%  348574 944955000    0%   /
devfs           194Ki  194Ki    0Bi   100%     672         0  100%   /dev
/dev/disk1s2    233Gi  3.1Gi   90Gi     4%    1380 944955000    0%   /System/Volumes/Preboot
/dev/disk1s4    233Gi   11Gi   90Gi    11%      11 944955000    0%   /System/Volumes/VM
/dev/disk1s6    233Gi   57Mi   90Gi     1%     716 944955000    0%   /System/Volumes/Update
/dev/disk1s1    233Gi  117Gi   90Gi    57% 3268468 944955000    0%   /System/Volumes/Data
map auto_home     0Bi    0Bi    0Bi   100%       0         0  100%   /System/Volumes/Data/home
/dev/disk1s5    233Gi   11Gi   90Gi    11%  349477 944955000    0%   /System/Volumes/Update/mnt1

image

$ cd /dev && ls -al | grep "disk*"
brw-r-----   1 root        operator        0x1000000 Mar  6 22:36 disk0
brw-r-----   1 root        operator        0x1000001 Mar  6 22:36 disk0s1
brw-r-----   1 root        operator        0x1000002 Mar  6 22:36 disk0s2
brw-r-----   1 root        operator        0x1000003 Mar  6 22:36 disk1
brw-r-----   1 root        operator        0x1000004 Mar  6 22:36 disk1s1
brw-r-----   1 root        operator        0x1000005 Mar  6 22:36 disk1s2
brw-r-----   1 root        operator        0x1000007 Mar  6 22:36 disk1s3
brw-r-----   1 root        operator        0x1000006 Mar  6 22:36 disk1s4
brw-r-----   1 root        operator        0x1000009 Mar  6 22:36 disk1s5
br--r-----   1 root        operator        0x100000a Mar  6 22:36 disk1s5s1
brw-r-----   1 root        operator        0x1000008 Mar  6 22:36 disk1s6
crw-r-----   1 root        operator        0x1000000 Mar  6 22:36 rdisk0
crw-r-----   1 root        operator        0x1000001 Mar  6 22:36 rdisk0s1
crw-r-----   1 root        operator        0x1000002 Mar  6 22:36 rdisk0s2
crw-r-----   1 root        operator        0x1000003 Mar  6 22:36 rdisk1
crw-r-----   1 root        operator        0x1000004 Mar  6 22:36 rdisk1s1
crw-r-----   1 root        operator        0x1000005 Mar  6 22:36 rdisk1s2
crw-r-----   1 root        operator        0x1000007 Mar  6 22:36 rdisk1s3
crw-r-----   1 root        operator        0x1000006 Mar  6 22:36 rdisk1s4
crw-r-----   1 root        operator        0x1000009 Mar  6 22:36 rdisk1s5
cr--r-----   1 root        operator        0x100000a Mar  6 22:36 rdisk1s5s1
crw-r-----   1 root        operator        0x1000008 Mar  6 22:36 rdisk1s6

image

(🐞 反爬虫测试!打击盗版⚠️)如果你看到这个信息, 说明这是一篇剽窃的文章,请访问 https://www.cnblogs.com/xgqfrms/ 查看原创文章!

Linux df command

The Linux df command, also known as disk free, is used to display free and used disk space for each file system on Linux and Unix-like systems.

Linux df 命令,也称为 disk free,用于显示 Linux 和类 Unix 系统上每个文件系统的空闲和已用磁盘空间

# df [options] [file_path]
Option | Description
-- | --
-a | To include dummy files in the output, which include zero block sizes
-B | To display block size in the specified unit, such as BM for MB and BG for GB
-h | To display block size in human-readable form <br/> 以人类可读的形式显示块大小
-i | Displays inode information instead of the block usage
-l | Displays disk space information of only the local file system
-T | Displays file system type, such as ext4 <br/> 显示文件系统类型,例如 ext4
-t | Limit to showing a specific filesystem type
-x | Excludes the specified file system type from the output

image

https://linuxopsys.com/topics/df-command-in-linux

refs

https://askubuntu.com/questions/166420/how-to-detect-an-usb-device

https://itsfoss.com/list-usb-devices-linux/

https://trendoceans.com/list-connected-usb-device/

https://linuxhint.com/list-usb-devices-linux/

https://linuxopsys.com/topics/list-usb-devices-in-linux

image

https://iboysoft.com/howto/how-to-find-usb-connected-devices-on-mac.html

https://apple.stackexchange.com/questions/170105/list-usb-devices-on-osx-command-line

https://www.quora.com/How-do-I-check-what-USB-devices-are-connected-to-a-Mac



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2023-03-31 16:26  xgqfrms  阅读(97)  评论(0编辑  收藏  举报