quota – Displays disk used space and limit

The quota command in Linux is used to display disk usage and limits for a user or a group of users. It is a useful tool for system administrators to monitor user disk usage and enforce disk quotas.

Overview

The quota command can be used in two ways: to display disk usage and limits for a specific user or for all users. Here are some examples:

To display disk usage and limits for a specific user, use the following command:

quota username

Replace username with the name of the user you want to check.

To display disk usage and limits for all users, use the following command:

quota -v

The -v option provides a verbose output that shows disk usage and limits for all users.

The output of the quota command includes the following information:

  • Disk space used by the user
  • Disk space limit for the user
  • Number of inodes used by the user
  • Inode limit for the user

Here’s an example output for the quota command:

Disk quotas for user username (uid 1000):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
/dev/sda1      12345    20000   25000            1000    0       0

In this example, the user username has used 12345 blocks of disk space out of a quota of 20000 blocks. The disk space limit is 25000 blocks. The user has used 1000 inodes out of an inode limit of 0.

Options

Here are the available options for the quota command:

Option Description
-u username Displays disk usage and limits for the specified user
-g groupname Displays disk usage and limits for the specified group
-v Provides a verbose output that shows disk usage and limits for all users
-q Displays only the quota limits
-s Displays only the disk usage
-c Displays the quota information in a comma-separated format
-f filename Uses the specified file instead of the default quota file

Troubleshooting tips

If you encounter issues with the quota command, here are some troubleshooting tips:

  • If you get an error message that says “quota: Mountpoint (or device) / not found or has no quota enabled”, it means that quotas are not enabled on the filesystem you are trying to check. You will need to enable quotas on the filesystem before you can use the quota command.
  • If you get an error message that says “quota: Cannot stat() mounted device /dev/sda1: No such file or directory”, it means that the device or mountpoint you are trying to check does not exist. Make sure you are specifying the correct device or mountpoint.
  • If you get an error message that says “quota: Quota file on /dev/sda1 (/quota.user) is not on the local filesystem”, it means that the quota file is located on a remote filesystem. You will need to mount the remote filesystem locally before you can use the quota command.

Notes

  • The quota command requires that quotas are enabled on the filesystem you are trying to check. You can enable quotas by adding the usrquota or grpquota option to the mount options in /etc/fstab.
  • The quota command uses the quota file located at /aquota.user or /aquota.group by default. You can specify a different file using the -f option.