{"id":12463,"date":"2019-03-27T01:52:40","date_gmt":"2019-03-27T01:52:40","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=12463"},"modified":"2019-03-27T01:52:40","modified_gmt":"2019-03-27T01:52:40","slug":"4-useful-way-to-know-plugged-usb-device-name-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/27\/4-useful-way-to-know-plugged-usb-device-name-in-linux\/","title":{"rendered":"4 Useful Way to Know Plugged USB Device Name in Linux"},"content":{"rendered":"<p>As a newbie, one of the many\u00a0<a href=\"https:\/\/www.tecmint.com\/tag\/linux-tricks\/\" target=\"_blank\" rel=\"noopener\">things you should master in Linux<\/a>\u00a0is identification of devices attached to your system. It may be your computer\u2019s hard disk, an external hard drive or removable media such USB drive or SD Memory card.<\/p>\n<p>Using USB drives for file transfer is so common today, and for those (new Linux users) who prefer to use the command line, learning the different ways to identify a USB device name is very important, when you need to format it.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/delete-all-files-in-directory-except-one-few-file-extensions\/\" target=\"_blank\" rel=\"noopener\">3 Ways to Delete All Files in a Directory<\/a><\/p>\n<p>Once you attach a device to your system such as a USB, especially on a desktop, it is automatically mounted to a given directory, normally under \/<strong>media\/username\/device-label<\/strong>\u00a0and you can then access the files in it from that directory. However, this is not the case with a server where you have to<a href=\"https:\/\/www.tecmint.com\/mount-filesystem-in-linux\/\" target=\"_blank\" rel=\"noopener\">\u00a0manually mount a device<\/a>\u00a0and specify its mount point.<\/p>\n<p>Linux identifies devices using special device files stored in\u00a0<code>\/dev<\/code>\u00a0directory. Some of the files you will find in this directory include\u00a0<code>\/dev\/sda<\/code>\u00a0or\u00a0<code>\/dev\/hda<\/code>\u00a0which represents your first master drive, each partition will be represented by a number such as\u00a0<code>\/dev\/sda1<\/code>\u00a0or\u00a0<code>\/dev\/hda1<\/code>\u00a0for the first partition and so on.<\/p>\n<pre>$ ls \/dev\/sda* \r\n<\/pre>\n<div id=\"attachment_23281\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-All-Linux-Device-Names.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23281\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-All-Linux-Device-Names.png\" alt=\"List All Linux Device Names\" width=\"568\" height=\"173\" aria-describedby=\"caption-attachment-23281\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-23281\" class=\"wp-caption-text\">List All Linux Device Names<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<p>Now let\u2019s find out device names using some different command-line tools as shown:<\/p>\n<h3>Find Out Plugged USB Device Name Using df Command<\/h3>\n<p>To view each device attached to your system as well as its mount point, you can use the\u00a0<a href=\"https:\/\/www.tecmint.com\/how-to-check-disk-space-in-linux\/\" target=\"_blank\" rel=\"noopener\">df command<\/a>\u00a0(checks Linux disk space utilization) as shown in the image below:<\/p>\n<pre>$ df -h\r\n<\/pre>\n<div id=\"attachment_23282\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/Find-USB-Device-Name.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23282\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/Find-USB-Device-Name.png\" alt=\"Find USB Device Name Using df Command\" width=\"667\" height=\"268\" aria-describedby=\"caption-attachment-23282\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-23282\" class=\"wp-caption-text\">Find USB Device Name Using df Command<\/p>\n<\/div>\n<h3>Use lsblk Command to Find USB Device Name<\/h3>\n<p>You can also use the\u00a0<a href=\"https:\/\/www.tecmint.com\/commands-to-collect-system-and-hardware-information-in-linux\/\" target=\"_blank\" rel=\"noopener\">lsblk command (list block devices)<\/a>\u00a0which lists all block devices attached to your system like so:<\/p>\n<pre>$ lsblk\r\n<\/pre>\n<div id=\"attachment_23283\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-Linux-Block-Devices.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23283\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-Linux-Block-Devices.png\" alt=\"List Linux Block Devices\" width=\"647\" height=\"230\" aria-describedby=\"caption-attachment-23283\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-23283\" class=\"wp-caption-text\">List Linux Block Devices<\/p>\n<\/div>\n<h3>Identify USB Device Name with fdisk Utility<\/h3>\n<p><a href=\"https:\/\/www.tecmint.com\/fdisk-commands-to-manage-linux-disk-partitions\/\" target=\"_blank\" rel=\"noopener\">fdisk is a powerful utility<\/a>\u00a0which prints out the partition table on all your block devices, a USB drive inclusive, you can run it will root privileges as follows:<\/p>\n<pre>$ sudo fdisk -l\r\n<\/pre>\n<div id=\"attachment_23284\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-Partition-Table.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23284\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/List-Partition-Table.png\" alt=\"List Partition Table of Block Devices\" width=\"659\" height=\"306\" aria-describedby=\"caption-attachment-23284\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-23284\" class=\"wp-caption-text\">List Partition Table of Block Devices<\/p>\n<\/div>\n<h3>Determine USB Device Name with dmesg Command<\/h3>\n<p><strong>dmesg<\/strong>\u00a0is an important command that prints or controls the kernel ring buffer, a data structure which\u00a0<a href=\"https:\/\/www.tecmint.com\/dmesg-commands\/\" target=\"_blank\" rel=\"noopener\">stores information about the kernel\u2019s operations<\/a>.<\/p>\n<p>Run the command below to view\u00a0<strong>kernel operation messages<\/strong>\u00a0which will as well print information about your USB device:<\/p>\n<pre>$ dmesg\r\n<\/pre>\n<div id=\"attachment_23285\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/dmesg-shows-kernel-information.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-23285\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2016\/10\/dmesg-shows-kernel-information.png\" alt=\"dmesg - Prints USB Device Name\" width=\"724\" height=\"306\" aria-describedby=\"caption-attachment-23285\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-23285\" class=\"wp-caption-text\">dmesg \u2013 Prints USB Device Name<\/p>\n<\/div>\n<p>That is all for now, in this article, we have covered different approaches of how to find out a USB device name from the command line. You can also share with us any other methods for the same purpose or perhaps offer us your thoughts about the article via the response section below.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/find-usb-device-name-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a newbie, one of the many\u00a0things you should master in Linux\u00a0is identification of devices attached to your system. It may be your computer\u2019s hard disk, an external hard drive or removable media such USB drive or SD Memory card. Using USB drives for file transfer is so common today, and for those (new Linux &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/03\/27\/4-useful-way-to-know-plugged-usb-device-name-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;4 Useful Way to Know Plugged USB Device Name in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-12463","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=12463"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12463\/revisions"}],"predecessor-version":[{"id":12467,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/12463\/revisions\/12467"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=12463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=12463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=12463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}