In this post I'm going to show you how to use the Unix df utility. It's an utility used to check the free space on partitions.

In questo post vi mostrerò come usare il programma Unix df. È un programma usato per controllare lo spazio libero sulle partizioni.

Basic tutorial on the df command

Hello world, today I will talk about another Unix utility.
This time it's the df command, an utility to check the free space on partitions.
Here are some of the available options:

  • -t T or --type=T:
    Show only file systems which have type T.
  • -x T or --exclude-type=T:
    Show every file system except those of type T.
  • -l or --local:
    Show only locally mounted file systems.
  • -i or --inodes:
    Show inodes.
  • -a or --all:
    Show all the available mount points.
  • -h or --human-readable:
    Show the output in human readable form, multipliers use multiples of 1024.
  • -H or --si:
    Same thing as -h, but here, multipliers use multiples of 1000.

Let's see some output examples, in order to understand how it works:

Standard output

  • Input:
    df
  • Output:
    File system        1K blocks   Used      Avail.  Use% Mounted on
    /dev/sda1            6332720   2677004  3334028  45%  /
    none                  291664       640   291024   1%  /dev
    none                  298280       132   298148   1%  /dev/shm
    none                  298280        96   298184   1%  /var/run
    none                  298280         0   298280   0%  /var/lock

Show the number of inodes, in a human readable form

  • Input:
    df -h -i
  • Output:
    File system        Inode   IUsed      IFree.  IUse% Mounted on
    /dev/sda1           393K    144K        250K    37% /
    none                 72K     792         71K     2% /dev
    none                 73K       6         73K     1% /dev/shm
    none                 73K      50         73K     1% /var/run
    none                 73K       1         73K     1% /var/lock

Show statistics only about ext4 partitions

  • Input:
    df -t ext4 -h
  • Output:
    File system        Size. Used Aval. Use% Mounted on
    /dev/sda1           6,1G  2,6  3,2G  45% /

Show statistics for every partition, except those of type ext4

  • Input:
    df --exclude-type ext4 -h
  • Output:
    File system        Size.    Used       Aval.   Use% Mounted on
    none                285M    640K        285M     1% /dev
    none                292M    132K        292M     1% /dev/shm
    none                292M     96K        292M     1% /var/run
    none                292M       0        292M     0% /var/lock

Ok, that's all for today, I hope this post will be a good reference, and as usual, see you another time, in another post!

Go back to the top, Share, Look at the comments or Comment yourself!

Tutorial di base sul comando df

Salve mondo, oggi vi parlerò di un altro programma Unix.
Questa volta si tratta del comando df, un programma per la verifica dello spazio libero nelle partizioni.
Ecco alcune delle opzioni disponibili:

  • -t T o --type=T:
    Mostra solo i file system di tipo T.
  • -x T o --exclude-type=T:
    Mostra tutti i file system tranne quelli di tipo T.
  • -l o --local:
    Mostra solo i file system montati localmente.
  • -i o --inodes:
    Mostra gli inode.
  • -a o --all:
    Mostra tutti i punti di montaggio disponibili.
  • -h or --human-readable:
    Mostra il risultato in forma intelligibile, i moltiplicatori utilizzano multipli di 1024.
  • -H or --si:
    Stessa cosa di -h, ma qui, i moltiplicatori usano multipli di 1000.

Vediamo alcuni esempi di output, per capire come funziona:

Output normale

  • Input:
    df
  • Output:
    File system        1K blocks   Used      Avail.  Use% Mounted on
    /dev/sda1            6332720   2677004  3334028  45%  /
    none                  291664       640   291024   1%  /dev
    none                  298280       132   298148   1%  /dev/shm
    none                  298280        96   298184   1%  /var/run
    none                  298280         0   298280   0%  /var/lock

Mostra il numero di inode, in forma comprensibile

  • Input:
    df -h -i
  • Output:
    File system        Inode   IUsed      IFree.  IUse% Mounted on
    /dev/sda1           393K    144K        250K    37% /
    none                 72K     792         71K     2% /dev
    none                 73K       6         73K     1% /dev/shm
    none                 73K      50         73K     1% /var/run
    none                 73K       1         73K     1% /var/lock

Mostra le statistiche solo per le partizioni ext4

  • Input:
    df -t ext4 -h
  • Output:
    File system        Size. Used Aval. Use% Mounted on
    /dev/sda1           6,1G  2,6  3,2G  45% /

Mostra le statistiche per ogni partizione, eccetto quelle di tipo ext4

  • Input:
    df --exclude-type ext4 -h
  • Output:
    File system        Size.    Used       Aval.   Use% Mounted on
    none                285M    640K        285M     1% /dev
    none                292M    132K        292M     1% /dev/shm
    none                292M     96K        292M     1% /var/run
    none                292M       0        292M     0% /var/lock

Ok, è tutto per oggi, spero che questo post sia un buon riferimento, come al solito, ci si vede un'altra volta, in un altro post!

Torna in cima, Condividi, Guarda i commenti o Commenta tu stesso!