Linux Limits

Ulimit

  • Sets user / group wide limits
  • ulimit
  • /etc/security/limits.conf
  • soft vs hard limits
knightfall@bloodcount:/home/bc$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 63118
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 63118
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
knightfall@bloodcount:/home/bc$ ulimit -n 2
knightfall@bloodcount:/home/bc$ ulimit -n
2
knightfall@bloodcount:/home/bc$ vi a
bash: start_pipeline: pgrp pipe: Too many open files
vi: error while loading shared libraries: libgtk-x11-2.0.so.0: 
cannot open shared object file: Error 24

These limits last for the session. If you want them to be permanent add them to /etc/profile or /home/<user>/.bashrc

 

Or, set the limits in the /etc/security/limits.conf

#<domain>      <type>  <item>         <value>
#
#root            hard    core            100000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0

Hard limits: set by root

Soft limits: can be set by the user

 

 

Linux Limits

By Zlatin Stanimirov

Linux Limits

  • 879