How to find on what partition is a file located

To find out on what partition is a file located, use the df command.

Watch Free Movies

Syntax: df path/to/file

$ df /etc/passwd
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 19609276 3227140 15386040 18% /

To filter the text, in order to get only the partition name, use this command:

$ df /etc/passwd | tail -1 | cut -d' ' -f 1
/dev/sda1

Scroll to Top