Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use ulimit under Linux

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to use ulimit under Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Ulimit is a computer command that is used to shell the resources consumed by the startup process and can be used to modify system resource limits.

View ulimit

Command format:

Ulimit [- SHacdefilmnpqrstuvx] parameter S: indicates the soft limit, when the limit value is exceeded, the alarm parameter H: indicates the hard limit, which must not exceed the limit value parameter a: all resource limits will be listed, such as: practical information: ulimit command detailed information: ulimit command detailed parameter c: when something goes wrong, the system may write the information of the program in memory as a file (debug) This kind of file is called core file (core file). This is to limit the maximum capacity of each core file d: maximum value of each process data segment parameter f: maximum file capacity parameter l: maximum physical memory that can be locked by the current shell parameter m: maximum value parameter of resident memory that can be used n: maximum number of file handles that each process can open at the same time parameter p: maximum value of pipe parameter s: stack Maximum parameter t: each process can use the maximum time parameter u of CPU: maximum process concurrency per user parameter v: maximum virtual memory available for current shell to modify ulimit

Command format:

Ulimit [- SHcdefilmnpqrstuvx] [limit]

By adding a limit value to the command you are viewing, you can adjust a limit, but only for the current login shell.

Parameter S means to set the soft limit; parameter H means to set the hard limit; when none is specified, both the soft limit and the hard limit are the specified values.

Permanently modify ulimit

The so-called permanent means that every time you log in to shell, the ulimit will be reset according to the configuration to achieve the effect of permanent effect.

Step 1:

Modify / etc/security/limits.conf

Add the following:

For more information about how to configure this file, please refer to the following

[root@CentOS646506 ~] # vim / etc/security/limits.conf* hard nproc 64000 * soft nproc 64000 * hard nofile 64000 * soft nofile 64000

The above indicates that the soft and hard limits of-u and-n are modified to 64000 at the same time.

Step 2:

Modify / etc/pam.d/login

Add the following:

[root@CentOS646506 ~] # vim / etc/pam.d/loginsession required pam_limits.so

The above indicates that pam is used to manage limit when logging in.

Step 3:

Modify / etc/profile

Add the following

[root@CentOS646506] # vim / etc/profileulimit-u 64000ulimit-n 64000

Each time you log in to shell, the two ulimit commands are initially executed and put into effect.

Make the configuration effective

Logging back in or using source / etc/profile takes effect immediately.

Source makes the current shell take effect on the contents of the specified file.

/ etc/security/limits.conf configuration details

Format:

Domain refers to the valid entity user name and can also be used by @ group to specify the user group * to indicate the default value type refers to the limit type soft soft limit hard hard limit item limit resource core with ulimit-cdata with ulimit-dfsize with ulimit-fmemloc with ulimit-lnofile with ulimit-scpu with ulimit-tnproc with ulimit-umaxlogins with the number of users maxsyslogins system can log in at the same time priority user process priority locks Users can lock the maximum value of the file sigpengding with ulimit-imsgqueue and ulimit-Q thank you for reading! This is the end of the article on "how to use ulimit under Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report