Linux Commands: Limit user resources


ulimit-Linux Command

ulimit command- Limit user resources
Syntax: ulimit [-acdfHlmnpsStuv] [limit]

Description: The shell contains a built-in command to limit file sizes, ulimit, which can also be used to display limitations on system resources
A second method for limiting the potential impact of runaway processes is to set limits on a per process basis. This can be achieved by setting the ulimit command in /etc/profile.
To set a soft limit on the maximum amount of memory available to a given process to a value that is less than the total amount of memory on the system on a system with 1 gig of real memory and 500 megs of virtual memory you would set the following values in /etc/profile:

ulimit -S -m 1000000
ulimit -S -v 500000

With this value set, the system will kill any process that tries to take up more resources than you have set as a limit.

Example: 

cindy:~> ulimit -a
core file size (blocks)0
data seg size (kbytes) unlimited
file size (blocks) unlimited
max locked memory (kbytes) unlimited
max memory size (kbytes) unlimited
open files 1024
pipe size (512 bytes) 8
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 512
virtual memory (kbytes) unlimited

Cindy is not a developer and doesn't care about core dumps, which contain debugging information on a program. If you do want core dumps, you can set their size using the ulimit command. Read the Info pages on bash for a detailed explanation.

Related: quota

Other Linux Commands:
alias , break , builtin , cal , case , cat , cd , cfdisk , chgrp , chmod , chown , chroot , cksum , cmp , comm , continue , cp , cron , crontab , csplit , cut , date , dc , dd , declare , df , diff , diff3 , dir , dircolors , dirname , dirs , du , echo , egrep , enable , env , eval , exec , expand , export , expr , factor , false , fdformat , fdisk , fgrep , find , fmt , fold , for , fsck , function , getopts , hash , hashcharacter , head , history , hostname , id , if , import , install , join , kill , less , let , ln , local , locate , logname , logout , lpc , lpr , lprm , ls , m4 , man , mbadblocks , mkdir , mkfifo , mknod , more , mount , mtools , mv , nice , nl , nohup , passwd , paste , period , popd , pr , printf , ps , pushd , pwd , quota , quotacheck , quotactl , ram , rcp , read , readonly , return , rm , rmdir , rsync , Run , sdiff , sed , select , seq , set , shift , shopt , shutdown , sleep , sort , split , su , sum , symlink , sync , tac , tail , tar , tee , Test , time , times , top , touch , tr , traceroute , true , tsort , tty , Type , ulimit , umask , uname , Unexpand , uniq , units , unset , unshar , until , useradd , usermod , users , uuencode , watch , wc , whereis , which , while , who , xargs , yes ,
Live2Support.com :
Product - Benefits - Features - How Does it Works - Pricing - SSL Certificates - Signup - Contactus - Login - Submit Resources