Skip to main content
8 events
when toggle format what by license comment
Oct 31 at 19:56 comment added SensorSmith I'm not sure about the portability but this can be simplified to DISKSIZE=$(df --output=avail / | tail -1). It would be good to mention WHY you "do it like". The potential advantage I see here is that you can avoid breaking background operations by not completely filling the disk and having other writes fail.
Oct 18, 2023 at 17:11 comment added Chris Combs note that the df "free space" stat is not strictly true--there is usually a percentage of free space reserved for the root user which is not included in the free space shown by df. In other words, to zero all of the free space, you need to go past that amount (as the root user)
Feb 23, 2021 at 18:54 comment added David I had to change the df / to df -P / due to my root having a long device name, since df splits long output to multiple lines otherwise. -P makes it output posix-style which lacks that feature.
May 6, 2020 at 11:17 comment added AdminBee Welcome to the site, and thank you for your contribution. Please note that the "backtick"-style for command substitutions is deprecated and the $( ... ) notation is now the recommended syntax. Also, would you mind editing your post to add some explanations on how your approach works, as answers should if possible be understandable to a wide range of audiences with different levels of expertise in shell scripting and filesystem manipulation.
S May 6, 2020 at 11:17 review Low quality posts
May 6, 2020 at 12:39
S May 6, 2020 at 11:17 review Late answers
May 6, 2020 at 12:17
May 6, 2020 at 11:08 review First posts
May 6, 2020 at 11:18
May 6, 2020 at 11:02 history answered Sun Rise CC BY-SA 4.0