Home / Alt manpages / quota(1)

  • quota(1)
  • User command
  • linux

Read Linux Disk Quotas Without Guessing at the Output

You will finish with a safe way to inspect the current user's disk quotas, restrict the check to local filesystems or one filesystem, and use machine-friendly exit statuses when a quota check is part of a script. The examples use quota 4.06 from package version 4.06-1build6, installed at /usr/bin/quota.

Allow about ten minutes. You need a shell and the quota package. Most checks are read-only and do not need sudo. Viewing another user's limits with -u, or viewing project quotas, is restricted to the superuser. This guide does not enable quotas or edit limits.

1. Check the installed command

Confirm the binary and package version before relying on option details. This is an ordinary, read-only check:

$ command -v quota
/usr/bin/quota
$ quota --version
Quota utilities version 4.06.
$ dpkg-query -W -f='${Package} ${Version}\n' quota
quota 4.06-1build6

The exact package revision will differ on another machine. Keep the version with an incident record or script test when output compatibility matters. The installed manual page is the contract for the command you are actually running.

2. Read the current user's quota

Run quota with no options:

$ quota
Disk quotas for user andy (uid 1004): none

On a host with quota records, the output normally identifies the user and then lists each filesystem's blocks, limits and, when available, inode usage. Space values and limits are reported in kilobytes by default, although the headings may call them blocks for historical reasons. The output depends on which mounted filesystems have quotas configured.

Checkpoint: a successful command is not proof that every mounted filesystem has a quota. It means quota completed its checks. A host can legitimately report no quota records.

3. Make the numbers easier to scan

Use -s or --human-readable when comparing usage by eye:

$ quota -s
Disk quotas for user andy (uid 1004): none

When quota data exists, this option lets the command choose readable units for space and inode fields. You can request units explicitly with two characters, one for space and one for inodes, using k, g or t. For example, -s g,t selects gigabyte-scale space units and the command's t inode unit. Do not add an explicit unit merely to make a screenshot look consistent: use the default or document the choice in a parser.

There is a common distraction here: -s changes presentation, not the quota configuration. It does not allocate space, change a limit or repair an over-quota filesystem.

4. Avoid remote filesystem delays

By default, quota checks the filesystems listed in /etc/mtab. For NFS mounts it may contact rpc.rquotad on the server. If you need a local-only answer, use -l:

$ quota -l -s
Disk quotas for user andy (uid 1004): none

This is useful on a laptop, during a network incident, or in a health check where an unavailable NFS server should not hold up local storage reporting. It also means the result deliberately excludes NFS quotas, so label the result as local-only.

-Q suppresses an error when an NFS quota server refuses a connection. Use it only when that refusal is expected and separately observable. Suppressing the diagnostic does not make the remote quota available.

5. Inspect one filesystem

Use -f with a filesystem name when a whole-machine scan is too broad:

$ quota -f / -s
Disk quotas for user andy (uid 1004): none

Replace / with the filesystem path you need, such as /home. The -f form means the command-line arguments are filesystem names, not user names. The long --filesystem=PATH option is different: it can be repeated, and remaining command-line arguments can still name users, groups or projects. Choose one form and keep its argument roles clear.

Checkpoint: if a filesystem check appears to miss a mount, verify the path and mount table with a separate read-only command:

$ findmnt /
$ findmnt /home

Do not treat a missing quota record as a mount failure. Filesystem mounting and quota accounting are separate configuration concerns.

6. Check whether anything is over quota

For a terse monitoring check, use -q:

$ quota -q
$ printf 'quota status: %s\n' "$?"
quota status: 0

Quiet mode prints only filesystems where usage is over quota. In the installed command, a zero status means quota did not find an over-quota condition. The manual documents a non-zero status as meaning that one or more filesystems are over quota. It is therefore better to test the status than to test whether output is empty.

if quota -q -l; then
    printf '%s\n' 'No local filesystem is over quota'
else
    status=$?
    printf 'Quota warning, status %s\n' "$status" >&2
    exit "$status"
fi

-q takes precedence over -v. Do not combine them expecting verbose output to win. If you need to see filesystems with no allocated storage as well, use -v without -q.

7. Query groups, users and projects carefully

The default is the current user's quota. -u makes that choice explicit. A superuser can name another user:

$ sudo quota -u USERNAME -s

Replace USERNAME with an actual account name. The command only reads quota information, but another user's storage usage is still operationally sensitive. Use the least privilege that answers the question, record why elevated access was needed, and do not paste private output into an issue without checking it first.

Use -g for group quotas. A non-superuser may inspect groups of which they are a member; naming an unrelated group is not a way to bypass that restriction. Use -P for project quotas, but the installed manual page limits project quota viewing to the superuser. These modes are not interchangeable: a user's quota, a group's quota and a project's quota can have different accounting rules.

8. Investigate an unhelpful result

Start with the narrowest read-only reproduction:

$ quota -l -s
$ printf 'status: %s\n' "$?"
$ findmnt --real

If the command reports no quota, check that the relevant filesystem is mounted and that quotas were actually configured by the system administrator. The quota command reports usage and limits; it does not turn accounting on, create quota files, or set limits. Those changes belong to tools such as quotaon, quotacheck and setquota, and should be planned separately because they can affect accounting and service operation.

If an NFS query fails, repeat with -l to answer the local question, then investigate the server and rpc.rquotad separately. Do not use -Q as a repair. If output is being consumed by a script, add -w to prevent long device names from wrapping across lines, and use -p when raw grace-period timestamps are required for parsing.

Done means

  • You confirmed the installed quota version and binary.
  • You can read the current user's quota and distinguish no records from an over-quota result.
  • You use -s for people and stable, documented options such as -w or -p for parsers.
  • You use -l when the question is local and know that it excludes NFS.
  • You reserve sudo for authorised checks of other users or project quotas.
  • You have not changed quota accounting, limits, mounts or services.