• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / Linux sysadmin tutorials linux system administrator / ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.

ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.

ulimit command unlimited in linux, set files, process limit for users, services, processes etc

Table of Contents

Toggle
    • ulimit command options
  • Increasing open file limits with ulimit command
    • change ulimit settings to increase file descriptor limit with ulimit unlimited
  • ulimit command to know Max user Process
  • changing max user process for current user with ulimit unlimited
    • ulimit open files unlimited means or  ulimit unlimited
    • how to check the ulimit value for a user in linux with command
    • ulimit value for max user processes
    • Linux accept more concurrent connections
  • to know ulimit hard limits in linux command terminal
  • to know ulimit soft limits
    • Recommended ulimit Settings for high performance
  • Faqs on ulimit unlimited command
      • what is ulimit in linux?
    • how to check ulimit for a user in linux?
    • how to set ulimit in linux?
    • how to set ulimit in linux permanently
  • ulimit open files cannot modify limit operation not permitted

ulimit command options

ulimit -n  –> It will display number of open files limit or open file descriptors
ulimit -c –> It display the size of core file
ulimit -u –> It will display the maximum user process limit for the logged in user.
ulimit -f –> It will display the maximum file size that the user can have.
umilit -m –> It will display the maximum memory size for logged in user.
ulimit -v –> It will display the maximum memory size limit
nproc
nofile
root@Ubuntu ~}$ ulimit -Hn
1048576
root@Ubuntu ~}$ ulimit -Sn
1024
effect immediately without logout and reboot.
sysctl -p
security/limit.conf user level

Increasing open file limits with ulimit command

$ ulimit -Hn
$ ulimit -Sn
before
~]$ ulimit -n -H
4096
~]$ ulimit -n -S
1024

change ulimit settings to increase file descriptor limit with ulimit unlimited

ulimit -n <value>
ulimit -n 100000
after change 
root@instance-1:~#ulimit -Sn
100000
root@instance-1:~# ulimit -Hn
100000
 change ulimit settings

ulimit command to know Max user Process

~]# su – oracle
~]$ ulimit -H -u
8096
~]$ ulimit -u -S
ulimit -u -H
root@instance-1:~# ulimit -H -u
31814
root@instance-1:~# ulimit -S -u
31814

changing max user process for current user with ulimit unlimited

ulimit -u 100000
root@instance-1:~# ulimit -u
31814
root@instance-1:~# ulimit -u 40000
root@instance-1:~# ulimit -u
40000
root@instance-1:~# ulimit -H -u
40000
root@instance-1:~# ulimit -S -u
40000
Restart needed to effect changes & also for applications too.

ulimit open files unlimited means or  ulimit unlimited

root@-s-4vcpu-8gb-blr1-01:~# ulimit
unlimited
unlimited means  no limit
ulimit -n  –> It will display number of open files limit or open file descriptors
memory, cpu, etc are unlimited for that users
root@-s-4vcpu-8gb-blr1-01:~# ulimit -aH
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31802
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 100000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31802
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
Aim:
  1. to Set max open file limits for user  or Process.
  2.  to set maximum process for user  / process ex: nginx
1 connection & 1 process= 1-2 open files double the number.
‘listen.backlog‘, which defaults to -1 (unlimited). However, this value is also limited by the system (sysctl) value ‘net.core.somaxconn’, which defaults to 128 on many Linux systems.
sysctl -a |grep net.core.somaxconn
root@instance-1:~# sysctl -a |grep net.core.somaxconn
net.core.somaxconn = 65536
nr_open
This denotes the maximum number of file-handles a process can allocate. Default value is 1024*1024 (1048576) which should be enough for most machines. Actual limit depends on RLIMIT_NOFILE resource limit.
inode-max denotes the maximum number of inode handlers. This value should be 3-4 times larger than the value in file-max, since stdin, stdout and network sockets also need an inode struct to handle them. When you regularly run out of inodes, you need to increase this value.
max user processes linux limits.conf

how to check the ulimit value for a user in linux with command

umilit -u

ulimit value for max user processes

root@instance-1:~# su – www-data -c “ulimit -Sa”
This account is currently not available.
Hard limits &. Soft limits
soft limit can be increased upto hard limit .
Finding ‘ulimit -a’ for process user nginx mysql php
ps aux | grep nginx
find ulimit of a process
cat /proc/PID/limits
root        8868  0.0  0.0 127044 24048 ?        Ss  May23  0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
cat /proc/8868/limits
max open files 1024

Linux accept more concurrent connections

net.core.somaxconn  default 128 to 65536 or
65535
Also see sysctl.conf
If you change the ulimit settings, you must restart your system for the changes to take effect.

to know ulimit hard limits in linux command terminal

root@instance-1:~# ulimit -aH
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31814
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 100000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) unlimited
cpu time (seconds, -t) unlimited
max user processes (-u) 31814
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

to know ulimit soft limits

type below command ulimit -aS
root@instance-1:~# ulimit -aS
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31814
max locked memory (kbytes, -l) 65536
max memory size (kbytes, -m) unlimited
open files (-n) 100000
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) 31814
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

Recommended ulimit Settings for high performance

Every deployment may have unique requirements and settings; however, the following thresholds and settings are particularly important for mongod and mongos deployments:

  • -f (file size): unlimited
  • -t (cpu time): unlimited
  • -v (virtual memory): unlimited
  • -l (locked-in-memory size): unlimited
  • -n (open files): 64000
  • -m (memory size): unlimited
  • -u (processes/threads): 64000

 

Faqs on ulimit unlimited command

what is ulimit in linux?

ulimit acronym for user limits generally used to set open files limits  for process & process limit for users.

how to check ulimit for a user in linux?

first you can login as a user, then type  ulimit -aH or ulimit -aS to list all limits.

how to set ulimit in linux?

to view:

ulimit -n

to set ulimit -n 10111

root@-s-4vcpu-8gb-blr1-01:~# ulimit -n
100000
root@-s-4vcpu-8gb-blr1-01:~# ulimit -n 10111
root@-s-4vcpu-8gb-blr1-01:~# ulimit -n
10111

 

how to set ulimit in linux permanently

you can use ulimit command and save changes permanently by adding UsePAM=yes in etc/ssh/sshd_config, or add /etc/security/limits.conf and restart

ulimit open files cannot modify limit operation not permitted

root@-s-4vcpu-8gb-blr1-01:~# ulimit -n 1048576
root@-s-4vcpu-8gb-blr1-01:~# ulimit -n 1048577
-bash: ulimit: open files: cannot modify limit: Operation not permitted

RHEL 5 has a maximum value of 1048576 (220) for this limit (NR_OPEN in /usr/include/linux/fs.h), and will not accept any larger value including infinity, even for root.  limit by linux kernel.2^20 limits

limit:
ulimit -n 1048576

 

Linux sysadmin tutorials linux system administrator

  • top 10 apt & apt-get commands (most used) apt vs apt-get
  • If-Else Statements in Shell Scripting
  • linux commands pdf (files & Directories, zip & unzip process, search etc)
  • Find Files with Specific Text on Linux grep find command
  • linux performance tuning inode limit file descriptors tco, kernel etc
  • Variables and Data Types in Shell Scripting
  • Top 10 most used Cat commands with examples (create, view, append files)
  • Ip tables / ufw / firewall d commands for block port ip rate limiting
  • Top 10 zip / tar commands to compress & extract files in linux
  • TOP 10 mv & cp commands in linux to move & copy files in Linux
  • Top 10 GREP Commands in linux to search files directory words strings
  • lsof netstat commands to know listening ports in linux 3 ways
  • Upgrade Ubuntu from 18.04 (19.10) to 20.04 LTS command line or gui server | desktop
  • 3 Ways (SCP, rsync, Sftp) linux server migration between two remote server apache nginx
  • linux system specs commands (CPU, Memory, Disk )speed, type. manufacture
  • linux sysctl command tweaks & hardening
  • linux security limits.conf deciding user limits process limits for nginx server
  • ulimit linux unlimited command unlimto set & know user limits open files file descriptor max user process etc.
  • red hat linux certification cost jobs salary syllabus courses fees
  • ufw firewall commads allow port enable disable ubuntu 20.04
  • ddos attack prevention
  • change ssh port in linux - avoid sshd ddos attacks
  • ping command
  • memcached install ubuntu wordpress
  • check linux version (lsb_release -a) ubuntu debian 32 or 64 bit
  • rsync command linux with examples comparison to scp
  • how to uninstall package in linux ubuntu rpm, yum apt-get
  • increase open file limit linux File descriptor ft nginx , mysql, lemp
  • remove repository ubuntu
  • htop commad memory details virtual vs shard vs resident
  • chown command in Linux with Examples
  • Kill PHP process
  • VIrtual Memory vs RSS Memory vs Shared memory in Linux
  • oom killer fixing it by configuration linux ubuntu
  • Install Lemp nginx mysql php fpm Stack on Debian 11 with repository
  • connect two remote servers linux command line
  • auto start after oom killer Mysql & php fpm nginx etc ubuntu wth systemd or cron job
  • load average Linux 1, 5, 15 min 2,4,8 cores explained
  • Control Structures in Shell Scripting
  • Shell Scripting Roadmap for Beginners to Advanced
  • awk commands with practical examples
  • Shell Scripting Tutorial for Beginners 🚀
  • find Command in Linux with Examples
  • sed Command in Linux with Examples (Beginner to Advanced)
  • Linux Text processing commands in with Examples
  • linux disk management commands
  • fdisk command in linux with examples
  • how to add a new disk in linux
  • Linux mount Command with Examples
  • fstab options with examples
  • Top 50 Shell Scripting Interview Questions and Answers
  • Linux Networking Interview Questions and Answers
  • Linux Networking Commands Cheat Sheet with Examples pdf
  • Netstat & SS Commands cheat sheet with examples Interview Questions
  • Nmap Cheat Sheet – Network Scanning & Security
  • Bash Brackets ([], (), {}, $( ), $(( ))) – Types, Uses & Examples

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy