ServerCake India

Which Command is used to Set Limits on File Size?

Set Limit Command
Limit File Size Graphical Illustration

What is known as file size?

A file size is the measure of space a file takes on a storage medium such as a computer hard drive. File sizes can be measured in bytes(B),kilobytes(Kb),megabytes(Mb),gigabytes(Gb),terabytes(Tb) and beyond.

Which Command is used to Set Limits on File Size?

Ulimit is the command used to control limits on system resources such as to process data size, virtual memory, and file size.This command sets limits on system resources or displays information about limits on system resources that have been set.This is also used to set upper limits on system resources that are specified by option specifications.

Limits are categorized either as soft or hard. With the ulimit command, you can change your soft limits, up to the maximum set by the hard limits. You must have root user authority to change resource hard limits.

Many systems do not contain one or more of these limits. The limit for a specified resource is set when the Limit parameter is specified. The value of the Limit parameter can be a number in the unit specified with each resource, or the value unlimited. To set the specific unlimit to unlimited, use the word unlimited.

The flags used by ulimit command are as follows

-a – Lists all the current resource limits.

-c – Specifies the size of core dumps, in a number of 512-byte blocks.

-d – Specifies the size of a data area, in a number of K bytes.

-f – Sets the file size limit in blocks when a limit parameter is used or reports the file size limit if no parameter is specified.This is the default flag.

-H – Specifies that the hard limit for given resource is set.If you have root user authority, a number you can increase the hard limit.Anyone can decrease it.

-m – Specifies the size of physical memo number of K bytes.This limit is not enforced by the system.

-n – Specifies the limit on the number of file descriptors a process may have.

-r – Specifies the limit on number of threads a process can have.

-s – Specifies the Stack size in number of K bytes.

-S – Specifies that the soft limit for a given resource is set.A soft limit can be increased upto the value of hard limit.

-t – Specifies the number of seconds to be used by each process.

-u – Specifies the limit on the number of process a user can create.

Editorial Team

Editorial Team at ServerCake India Blog is a team of experts in Server Administration, Business Development, Management, SEO Analyst & Graphic Designers with more than 5+ years of expertise.

Add comment