Questions tagged [limit]

Limiting the usage of a resource (memory, disk space, CPU time, open files, network bandwidth, …) by a process or a group of processes.

A limit is a restriction on a program that prevents it from using more than a set amount of resources, such as memory, disk space, CPU time, open files, network bandwidth, etc.

The ulimit built-in of POSIX shells lets a user set limits on the shell process and the programs that it subsequently invokes. The set of supported resources varies depending on the shell and the operating system.

256 questions
202
votes
5 answers

do changes in /etc/security/limits.conf require a reboot?

Do changes in /etc/security/limits.conf require a reboot before taking effect? For example, if I have a script that sets the following limits in /etc/security/limits.conf, does this require a system reboot before those limits will take effect? *…
Alexej Magura
  • 4,356
  • 7
  • 26
  • 39
181
votes
8 answers

How do I limit the number of files printed by ls?

Is there a way to limit the quantity of listed files on a ls command? I've seen: ls | head -4 but to get head or tail to be executed I need to wait for ls to finish execution, and with directories with an enourmous quantity of files that can take…
AndreDurao
  • 2,010
  • 2
  • 13
  • 8
167
votes
3 answers

Why is number of open files limited in Linux?

Right now, I know how to: find open files limit per process: ulimit -n count all opened files by all processes: lsof | wc -l get maximum allowed number of open files: cat /proc/sys/fs/file-max My question is: Why is there a limit of open files in…
xanpeng
  • 5,595
  • 7
  • 24
  • 20
94
votes
2 answers

How to limit a process to one CPU core in Linux?

How to limit process to one cpu core ? Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with all it's children, processes (threads)) to use one…
Grzegorz Wierzowiecki
  • 13,865
  • 23
  • 89
  • 137
59
votes
4 answers

Creating threads fails with “Resource temporarily unavailable” with 4.3 kernel

I am running a docker server on Arch Linux (kernel 4.3.3-2) with several containers. Since my last reboot, both the docker server and random programs within the containers crash with a message about not being able to create a thread, or (less often)…
cdauth
  • 1,387
  • 2
  • 12
  • 19
51
votes
3 answers

How to create a user with limited RAM usage?

So I have 4 GB RAM + 4GB swap. I want to create a user with limited ram and swap: 3 GB RAM and 1 GB swap. Is such thing possible? Is it possible to start applications with limited RAM and swap avaliable to them without creating a separate user (and…
myWallJSON
  • 1,121
  • 3
  • 14
  • 20
50
votes
5 answers

How can I increase open files limit for all processes?

I can use ulimit but I think that only affects my shell session. I want the limit increased for all processes. This is on Red Hat.
user5554
47
votes
7 answers

Limiting processes to not exceed more than 10% of CPU usage

I operate a Linux system which has a lot of users but sometimes an abuse occurs; where a user might run a single process that uses up more than 80% of the CPU/Memory. So is there a way to prevent this from happening by limiting the amount of CPU…
Giovanni Mounir
  • 807
  • 2
  • 9
  • 12
46
votes
4 answers

Modify ulimit (open files) of a specific process

Is it possible to change the soft - and hard limit of a specific process? In my case, my process is mongod and a lot of web resources tell me to simply execute: ulimit -n My current thoughts: How will the command know the limit of…
test
  • 569
  • 1
  • 4
  • 5
44
votes
7 answers

Is there a way to limit the amount of memory a particular process can use in Unix?

I need to test a process for memory management. I do not have the source, so I need to do all the testing from the OS side. I want to be able to say something like limitmemory 400k -p Is there a way to do this in unix? Any common unix…
Lazer
  • 34,477
  • 25
  • 70
  • 75
40
votes
4 answers

How to Throttle per process I/O to a max limit?

I'm looking for a way to limit a processes disk io to a set speed limit. Ideally the program would work similar to this: $ limitio --pid 32423 --write-limit 1M Limiting process 32423 to 1 megabyte per second hard drive writing speed.
Sepero
  • 1,569
  • 3
  • 20
  • 29
38
votes
3 answers

Limit max connections per IP address and new connections per second with iptables

We have an Ubuntu 12.04 server with httpd on port 80 and we want to limit: the maximum connections per IP address to httpd to 10 the maximum new connections per second to httpd to 150 How can we do this with iptables?
evachristine
  • 2,603
  • 10
  • 39
  • 55
35
votes
1 answer

sudo: ulimit: command not found

On Ubuntu 12.04, I ran ulimit -n, it is showing 1024. I want to increase my open file limit from 1024 to 65535, so I tried the following command: sudo ulimit -n 65535 but I get the following error: sudo: ulimit: command not found How do I…
sunpy
  • 451
  • 1
  • 4
  • 3
35
votes
9 answers

Make disk/disk copy slower

Is there a method of slowing down the copy process on Linux? I have a big file, say 10GB, and I'd like to copy it to another directory, but I don't want to copy it with full speed. Let's say I'd like to copy it with the speed of 1mb/s, not faster.…
antonone
  • 612
  • 1
  • 6
  • 13
34
votes
8 answers

How to limit log file size using >>

How can I limit the size of a log file written with >> to 200MB? $ run_program >> myprogram.log
david
  • 343
  • 1
  • 3
  • 5
1
2 3
17 18