- Find external and internal devices attached to a system in Linux
- 3 Answers 3
- linux list devices
- How much RAM do I have Linux?
- How do I see devices on Linux?
- How do I create a device on Linux?
- What are the two types of device files?
- Does Linux have a device manager?
- How do I check my RAM size?
- How much RAM does Windows 10 take up?
- How much RAM do you need for Ubuntu?
- Why do people use Linux?
- Does Apple use Linux?
- Find all storage devices attached to a Linux machine [closed]
- 7 Answers 7
- Side Note
Find external and internal devices attached to a system in Linux
How can I find through terminal which devices are external and which are internal? By external I mean devices that are attached to a USB port. For Example, USB Drive, Portable USB hard drive etc. By internal I mean devices attached internally. For Example, SATA hard disk etc.
3 Answers 3
In addition to checking dmesg output, you can also use the programs lshw , lspci , lsusb , and lshal to query various hardware subsystems to locate currently-attached devices.
On Debian and Debian-based distributions like Ubuntu, these are provided by the packages lshw, pciutils, usbutils, and hal, respectively.
Here’s a sample of the output from lshw on my Debian system. I don’t have any USB devices attached at present, but you can see each individual USB controller. Any attached USB devices would be shown under their parent controllers, in the same manner that the hard drive (/dev/hde) and CD drive (/dev/hdb) are shown.
$ sudo lshw -short H/W path Device Class Description =================================================== system To be Filled /0 bus Intel 440BX/GX /0/0 memory 64KiB BIOS /0/4 processor Pentium III (Katmai) /0/4/6 memory 32KiB L1 cache /0/4/7 memory 512KiB L2 cache /0/5 processor Pentium III (Katmai) /0/5/0 memory 32KiB L1 cache /0/5/1 memory 512KiB L2 cache /0/1 memory 639MiB System memory /0/100 bridge 440BX/ZX/DX - 82443BX/ZX/DX Host bridge /0/100/1 bridge 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge /0/100/7 bridge 82371AB/EB/MB PIIX4 ISA /0/100/7.1 storage 82371AB/EB/MB PIIX4 IDE /0/100/7.1/0 ide0 bus IDE Channel 0 /0/100/7.1/0/1 /dev/hdb disk TSST CDW/DVD TS-H492A /0/100/7.1/1 ide1 bus IDE Channel 1 /0/100/7.2 bus 82371AB/EB/MB PIIX4 USB /0/100/7.2/1 usb1 bus UHCI Host Controller /0/100/7.3 bridge 82371AB/EB/MB PIIX4 ACPI /0/100/10 storage 20269 /0/100/10/2 ide2 bus IDE Channel 0 /0/100/10/2/0 /dev/hde disk 320GB ST3320620A /0/100/12 eth0 network LNE100TX /0/100/13 bus VT82xxxxx UHCI USB 1.1 Controller /0/100/13/1 usb2 bus UHCI Host Controller /0/100/13.1 bus VT82xxxxx UHCI USB 1.1 Controller /0/100/13.1/1 usb3 bus UHCI Host Controller /0/100/13.2 bus USB 2.0 /0/100/13.2/1 usb4 bus EHCI Host Controller
linux list devices
In Linux various special files can be found under the directory /dev . These files are called device files and behave unlike ordinary files. The most common types of device files are for block devices and character devices.
How much RAM do I have Linux?
To see the total amount of physical RAM installed, you can run sudo lshw -c memory which will show you each individual bank of RAM you have installed, as well as the total size for the System Memory. This will likely presented as GiB value, which you can again multiply by 1024 to get the MiB value.
How do I see devices on Linux?
- The mount Command. .
- The lsblk Command. .
- The df Command. .
- The fdisk Command. .
- The /proc Files. .
- The lspci Command. .
- The lsusb Command. .
- The lsdev Command.
How do I create a device on Linux?
- Build the driver by using Makefile ( sudo make )
- Load the driver using sudo insmod.
- Check the device file using ls -l /dev/ . By this time device file is not created for your driver.
- Create a device file using mknod and then check using ls -l /dev/ .
What are the two types of device files?
Does Linux have a device manager?
There are endless Linux command-line utilities that show the details of your computer’s hardware. . It’s like Windows Device Manager for Linux.
How do I check my RAM size?
Right-click your taskbar and select “Task Manager” or press Ctrl+Shift+Esc to open it. Click the “Performance” tab and select “Memory” in the left pane. If you don’t see any tabs, click “More Details” first. The total amount of RAM you have installed is displayed here.
How much RAM does Windows 10 take up?
In regards to Windows 10 RAM requirements, nowadays most basic Windows 10 systems comes with 4GB of RAM. Especially if you intend to run a 64-bit Windows 10 operating system, 4GB RAM is the minimum requirement. With a 4GB RAM, the Windows 10 PC performance will be boosted.
How much RAM do you need for Ubuntu?
Can Ubuntu run on 1gb RAM? The official minimum system memory to run the standard installation is 512MB RAM (Debian installer) or 1GB RA< (Live Server installer). Note that you can only use the Live Server installer on AMD64 systems. Once again, these are the bare minimum specifications.
Why do people use Linux?
1. High security. Installing and using Linux on your system is the easiest way to avoid viruses and malware. The security aspect was kept in mind when developing Linux and it is much less vulnerable to viruses compared to Windows.
Does Apple use Linux?
Both macOS—the operating system used on Apple desktop and notebook computers—and Linux are based on the Unix operating system, which was developed at Bell Labs in 1969 by Dennis Ritchie and Ken Thompson.
Java
How to Install Java 11/8 on FedoraStep 1 – Search Java Packages. The OpenJDK rpm packages are available under the AppStream repository. . Step 2 – I.
Mysql
How do I install MySQL Workbench on Ubuntu?How do I run MySQL Workbench on Ubuntu?How do I install MySQL workbench?What is the command for installing .
Grub
How do I update my bootloader Arch?How do I update-grub?How do I change GRUB bootloader in Linux?How do I update-grub manjaro?How do I reinstall grub .
Latest news, practical advice, detailed reviews and guides. We have everything about the Linux operating system
Find all storage devices attached to a Linux machine [closed]
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices ( hd* and sd* ). Is there a better solution, or should I stick with this one?
Since you talk about them maybe being mounted, I guess you want a list of partitions, not just of disks?
partitions are fine, too, yes 🙂 .. if I know the partitions, I’ll also know what physical devices are available
@warren — oh no. They still should be closed. As you as the post owner want this moved you should flag it for moderator attention. The fact that you want it moved will carry some weight.
7 Answers 7
/proc/partitions will list all the block devices and partitions that the system recognizes. You can then try using file -s to determine what kind of filesystem is present on the partition, if any.
There’s kind of a limit on what you can do from a shell. Most of the other suggestions that are higher rated either don’t work from a shell, won’t work unless dbus is running, or will list devices that aren’t actually present/configured. This is just faster than checking all the /dev devices.
You can always do fdisk -l which seems to work pretty well, even on strange setups such as EC2 xvda devices.
Here is a dump for a m1.large instance:
root@ip-10-126-247-82:~# fdisk -l Disk /dev/xvda1: 10.7 GB, 10737418240 bytes 255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/xvda1 doesn't contain a valid partition table Disk /dev/xvda2: 365.0 GB, 365041287168 bytes 255 heads, 63 sectors/track, 44380 cylinders, total 712971264 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/xvda2 doesn't contain a valid partition table Disk /dev/xvda3: 939 MB, 939524096 bytes 255 heads, 63 sectors/track, 114 cylinders, total 1835008 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/xvda3 doesn't contain a valid partition table
root@ip-10-126-247-82:~# mount /dev/xvda1 on / type ext4 (rw) proc on /proc type proc (rw,noexec,nosuid,nodev) sysfs on /sys type sysfs (rw,noexec,nosuid,nodev) fusectl on /sys/fs/fuse/connections type fusectl (rw) none on /sys/kernel/debug type debugfs (rw) none on /sys/kernel/security type securityfs (rw) udev on /dev type devtmpfs (rw,mode=0755) devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620) tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755) none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880) none on /run/shm type tmpfs (rw,nosuid,nodev) /dev/xvda2 on /mnt type ext3 (rw)
root@ip-10-126-247-82:~# cat /proc/partitions major minor #blocks name 202 1 10485760 xvda1 202 2 356485632 xvda2 202 3 917504 xvda3
Side Note
How fdisk -l works is something I would love to know myself.