quotactl

systemLinux/Unix
The quotactl command is one of the most frequently used commands in Linux/Unix-like operating systems. quotactl Manipulate disk quotas

Quick Reference

Command Name:

quotactl

Category:

system

Platform:

Linux/Unix

Basic Usage:

quotactl [options] [arguments]

Common Use Cases

    Syntax

    quotactl command special [id quota]

    Options

    Option Description
    -u Operate on user quotas
    -g Operate on group quotas
    -p Print quota information
    -s Turn on quotas
    -d Turn off quotas
    -e Enable enforcement
    -t Set quota timeout
    -i Initialize quota tables
    -v Display version information
    -h Display help information

    Examples

    How to Use These Examples

    The examples below show common ways to use the quotactl command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.

    # Basic Examples Basic
    sudo quotactl -p /dev/sda1
    Print quota information for the specified device.
    sudo quotactl -v
    Display version information for the quota system.
    # Advanced Examples Advanced
    sudo quotactl -u -s /dev/sda1 Turn on user quotas for the specified device. sudo quotactl -g -s /dev/sda1 Turn on group quotas for the specified device. sudo quotactl -u -e /dev/sda1 Enable enforcement of user quotas for the specified device. sudo quotactl -g -e /dev/sda1 Enable enforcement of group quotas for the specified device. sudo quotactl -u -d /dev/sda1 Disable user quotas for the specified device. sudo quotactl -g -d /dev/sda1 Disable group quotas for the specified device. sudo quotactl -u -t /dev/sda1 1000 Set the timeout for the specified user quota (1000 seconds). sudo quotactl -g -t /dev/sda1 1000 Set the timeout for the specified group quota (1000 seconds).

    Try It Yourself

    Practice makes perfect! The best way to learn is by trying these examples on your own system with real files.

    Understanding Syntax

    Pay attention to the syntax coloring: commands, options, and file paths are highlighted differently.

    Notes

    The `quotactl` command is a low-level interface for manipulating disk quotas in Unix and Linux operating systems. It provides direct access to the kernel's quota control mechanisms, allowing system administrators to enable, disable, and configure quota enforcement. While most administrators typically use higher-level commands like `quota`, `edquota`, `repquota`, `quotaon`, and `quotaoff` for quota management, `quotactl` serves as the underlying system call that these commands utilize. It offers more direct control for advanced scenarios or when creating custom quota management tools. The command operates on both user and group quotas, allowing administrators to: 1. Enable or disable quota tracking 2. Turn enforcement on or off 3. Set grace periods for exceeding soft limits 4. Initialize quota tables 5. Query current quota settings `quotactl` requires root privileges to execute, as it directly modifies kernel-level quota parameters. It operates on devices rather than mount points, so administrators need to specify the actual device (e.g., /dev/sda1) rather than a mount point (e.g., /home). The command's syntax can be somewhat complex, which is why most administrators prefer to use the more user-friendly wrapper commands for routine quota management tasks. However, understanding `quotactl` provides insight into how the quota system works at a lower level. Quota systems are crucial for managing disk space on multi-user systems, preventing individual users or groups from consuming excessive storage resources. They are commonly used in: - Shared hosting environments - Educational institution computing facilities - Corporate file servers - Any multi-user system where equitable resource allocation is important The Linux kernel implements quotas through the VFS (Virtual Filesystem) layer, allowing quotas to work across different filesystem types. Modern Linux distributions typically support various quota formats, including the older VFS v0 format and the newer VFS v1 format with additional features. `quotactl` is part of the quota package in most Linux distributions, along with the other quota management tools. It's the most direct way to interact with the kernel's quota subsystem but requires careful use due to its lower-level nature.

    Related Commands

    These commands are frequently used alongside quotactl or serve similar purposes:

    Use Cases

    Learn By Doing

    The best way to learn Linux commands is by practicing. Try out these examples in your terminal to build muscle memory and understand how the quotactl command works in different scenarios.

    $ quotactl
    View All Commands