Using the terminal, how can I see the directory (and files) in an external HDD attached via USB port? (I am a beginner so would appreciate simple instructions. I have tried to find the answer through "search" - there are similar questions with answers that I tried to bend to my needs but could not - sorry).


The topic that you're looking for is mounting . In the file manager you just click on the button to open it or detach the drive, but behind the scenes it uses udisksctl . Big advantage of this command is that it mounts as your user, and you don't have to specify whole lot of options, unlike the classic mount command.

For instance, to mount your usb drive, find device path with either lsblk or sudo blkid and then mount like so, for example,

udisksctl mount -b /dev/sdb1

Of course remember to replace sdb1 with the actual device name you want to mount.

Once the device is mounted successfully, it will be reported where it is mounted. For example,

skolodya@ubuntu:$ udisksctl mount -b /dev/sdb5
Mounted /dev/sdb5 at /media/xieerqi/0ca7543a-5463-4a07-8bbe-233a7b0bd625.

Then you could navigate to /media/$USER/folder-name and start exploring files and folders

| improve this answer | |

USB media are normally mounted at /media go there in your terminal with cd /media && ls now you should see all storage mounted in that directory. If your device is in the list use cd to change in that directory and use ls or ll to list the files in your hdd.

If the hdd is not listed open your file Browser and usectrl+ l to go in the adress bar. There you can see the path of your hdd.

| improve this answer | |
  • Thank you - I really appreciate your help. Unfortunately mine was not listed under media. – Duncan Jan 22 '16 at 16:25
  • I just plugged in my USB external drive and was wondering about the same question. It took a minute or so until it showed up in <pre>media</pre>. – Norbert S Oct 30 '19 at 0:56

Just a small addition to previous answer : If you started on a command line machine, or a headless system (like a rpi for example), device will probably not mount automatically.

You then should first search for his device name (sudo fdisk -l) and then mount it in an empty folder (sudo mount /dev/sdb1 /media/myNewlyCreatedFolder)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.