Managing Quotas with edquota (with examples)
- Linux
- November 5, 2023
Edit quota of the current user
edquota --user $(whoami)
Motivation for using the example
Sometimes, as a system administrator, you may need to modify the quota limits of a user. This command allows you to quickly edit the quota of the current user without the need to manually locate and edit the quota files.
Explanation of the arguments
--user
: This argument specifies that we want to edit the quota for a specific user.$(whoami)
: This command substitution retrieves the username of the current user.
Example output
The command will open the quota editor for the current user, displaying the current quota limits and grace periods. From there, you can modify the values according to your needs.
Edit quota of a specific user
sudo edquota --user username
Motivation for using the example
As a system administrator, there may be instances where you need to modify the quota limits for a specific user. This command allows you to edit the quota of the specified user.
Explanation of the arguments
--user
: Specifies that we want to edit the quota for a specific user.username
: The username of the user whose quota you want to edit.
Example output
The command will open the quota editor for the specified user, displaying the current quota limits and grace periods. You can then modify the values as necessary.
Edit quota for a group
sudo edquota --group group
Motivation for using the example
In certain scenarios, you may want to modify the quota limits for an entire group of users. This command allows you to edit the quota for a specific group, ensuring consistent limits for all members of the group.
Explanation of the arguments
--group
: Specifies that we want to edit the quota for a specific group.group
: The name of the group whose quota you want to edit.
Example output
The command will open the quota editor for the specified group, displaying the current quota limits and grace periods. You can then modify the values for the group as needed.
Restrict operations to a given filesystem
sudo edquota --file-system filesystem
Motivation for using the example
By default, the edquota
command operates on all filesystems with quotas. However, there may be cases where you want to restrict the quota operations to a specific filesystem. This command allows you to specify the filesystem for which you want to edit the quotas.
Explanation of the arguments
--file-system
: Specifies that we want to edit the quotas only for a specific filesystem.filesystem
: The name or path of the filesystem for which you want to edit the quotas.
Example output
The command will open the quota editor only for the specified filesystem, displaying the current quota limits and grace periods for the users or groups associated with that filesystem. You can then modify the values accordingly.
Edit the default grace period
sudo edquota -t
Motivation for using the example
The grace period is the time interval after a user exceeds their quota limit before the system starts enforcing restrictions. Sometimes, you may need to adjust the default grace period for all users or groups. This command allows you to modify the default grace period for quotas.
Explanation of the arguments
-t
: Specifies that we want to edit the default grace period.
Example output
The command will open the quota editor for the default grace period, displaying the current value. You can then modify the value to the desired time interval.
Duplicate a quota to other users
sudo edquota -p reference_user destination_user1 destination_user2
Motivation for using the example
Often, you may want to set the same quota limits for multiple users based on the limits of a reference user. This command allows you to duplicate the quota settings of a reference user to other users easily.
Explanation of the arguments
-p
: Specifies that we want to duplicate the quota settings from a reference user to destination users.reference_user
: The username of the reference user whose quota settings you want to duplicate.destination_user1
,destination_user2
: The usernames of the destination users to which you want to apply the quota settings.
Example output
The command will duplicate the quota settings of the reference user to the specified destination users. The quota limits and grace periods of the reference user will be applied to the destination users.
These examples demonstrate different use cases of the edquota
command for managing quotas. They provide a convenient way to modify quota limits for users, groups, and filesystems, as well as to adjust the default grace period and duplicate quota settings. With these commands at your disposal, you can efficiently manage quota configurations according to your system’s requirements.