F
F
fokin_nikolay19892016-09-28 14:15:11
linux
fokin_nikolay1989, 2016-09-28 14:15:11

Is it possible to determine the remaining free space on the disk where the file is located!?

Can you guys determine how many percent of free disk space is left where the file lies, by specifying the path to the file displays the remaining free disk space?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2016-09-29
@keich

df with the path to the file as a parameter will display a line on the device on which the folder is located. (tested on debian 8 )
df ./ | awk 'END { print "Free " 100-int($5) "%"}'

O
Oleg Tsilyurik, 2016-09-28
@Olej

Achieve your goal by combining the results:

$ mount | grep sd
...
$ df | grep sd
...

D
Dmitry Bannik, 2016-09-28
@prodimon

df /home | awk '{print $5}' | tail -n1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question