How to find out what device a file or folder is on?

6,627

You can use:

df /path/to/filename

It will show the path base mount point.

Share:
6,627

Related videos on Youtube

dv3500ea
Author by

dv3500ea

I am an Ubuntu user (since Jaunty) and also a programmer (by hobby - no formal education). I found the community on Ubuntu Forums extremely helpful and so started to return the favour and never stopped :) I am currently involved with the development of the following FOSS projects: DMedia - a distributed media library, to be used by the Novacut video editor. (IRC: #novacut) QR Tools - tools for creating and reading QR codes. Both of these projects actively welcome new contributors so feel free to help out. If you are interested but don't know where to start feel free to contact me. If you find my answers helpful, and you have money to waste spare, you may donate to me via: flattr Bitcoin - 14wAQSJT4F1QsUUdUVvZS5TXmgvCyNr1ET youtipit

Updated on September 17, 2022

Comments

  • dv3500ea
    dv3500ea over 1 year

    Is it possible to query (using the command line) what device a particular file or folder is on?

    All files are on some sort of storage device (eg. /dev/sda1). These storage devices are mounted at a particular point in the file system hierarchy (eg. /, /home).

    I want to find out what device a file is on. For example, if /dev/sda3 is mounted on /home, given the file ~/document.odt, what command can I use to determine that the file is on /dev/sda3?

  • GDP2
    GDP2 about 8 years
    The -h option (df -h) is also useful.
  • Scott Stensland
    Scott Stensland about 7 years
    yes -h is very nice ( show in human readable format )