How to find on what partition is a file located

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

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

Tagged with: , , ,
Posted in The Linux and Unix Articles!

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!