serhii.net

In the middle of the desert you can say anything you want

17 Nov 2021

211117-2112 df for current filesystem or speficied file

TIL df -h filename (or more likely df -h .) returns the info about the filesystem that file is in. Will save me a lot of time, since usually that’s exactly teh one I need.

Story behind this: Mistyped df -h as df -, it returned:

Filesystem                  1K-blocks      Used Available Use% Mounted on
/dev/mapper/ubuntu--vg-root 488960032 463006852   1045612 100% /

Wanted to find out what happened. Likely this:

  • - in zsh is the last directory you were in (since cd - does gets you there)
  • man df says that:
     df displays the amount of disk space
           available on the file system containing each file name argument.  If no file name is given,
           the space available on all currently mounted file systems is shown.
    
  • -> It was showing the file system the previous dir was in, which was the current filesystem.
Nel mezzo del deserto posso dire tutto quello che voglio.