cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Commander Commander
Commander
  • 425 Views

Limit File Size

Want to limit the size of any files that can be created?  Use this guy:   ulimit

ulimit is a built-in Linux shell command, that allows viewing or limiting system resource amounts - that invidual users consume.

Per the man page, the syntax for the command is as follows:   
      ulimit  [-HS]  [options  [limit]]

So, if you wanted to limit the size of any file that can be created to 2KB, the following command will get the job done:

 ulimit  -f  2

Any attempt to create a file beyond the size of 2KB, and you will be greeted with the following polite message:     File size limit exceeded (core dumped)


There are other resources that this wonderful command can place a limit on.  A great tool to prevent deliberate misbehaviors, or inadvertent usage.

Trevor "Red Hat Evangelist" Chandler
1 Reply
Blue_bird
Starfighter Starfighter
Starfighter
  • 366 Views

Nice..Thanks for sharing..!

Join the discussion
You must log in to join this conversation.