The prlimit command is a Linux utility that allows users to view and modify the resource limits for a given process. On a Linux system, various resources such as memory, CPU time, number of files, and open file descriptors are allocated to each process. These limits are in place to prevent a single process from consuming too many system resources and affecting the overall performance and stability of the system.
With prlimit, you can get or set the soft and hard limits for one or more resources associated with a specific process ID. The “soft limit” is the current limit of the resource that the process is allowed to use, while the “hard limit” is the maximum limit that the process can be raised to.
If you encounter the below error while running the command prlimit:
prlimit: command not found
you may try installing the below package as per your choice of distribution:
Distribution | Command |
---|---|
Debian | apt-get install util-linux |
Ubuntu | apt-get install util-linux |
Alpine | apk add util-linux |
Arch Linux | pacman -S util-linux |
Kali Linux | apt-get install util-linux |
CentOS | yum install util-linux |
Fedora | dnf install util-linux |
OS X | brew install rename |
Raspbian | apt-get install util-linux |
prlimit Command Examples
1. Display limit values for all current resources for the running parent process:
# prlimit
2. Display limit values for all current resources of a specified process:
# prlimit --pid pid number
3. Run a command with a custom number of open files limit:
# prlimit --nofile=10 command