What is the usage of the ulimit command in Linux?

The ulimit command in Linux is used to set limits on the resources available to user processes. This allows administrators to restrict system resources that user processes can access, such as maximum file size, maximum number of processes, and maximum number of open files.

Common uses of the ulimit command include:

  1. ulimit -a: display all resource limits for the current user.
  2. ulimit -c unlimited: Set the maximum size of core files to unlimited.
  3. Set the maximum number of open files to 10000 using ulimit -n 10000.
  4. Set the maximum number of user processes to 200 with ‘ulimit -u 200’.
  5. ulimit -f 1024: Set the maximum file size to 1024KB.
  6. Set the maximum virtual memory size to unlimited with the command ulimit -v unlimited.

It’s important to note that the ulimit command only takes effect on processes within the current session. If you want to permanently set resource limits, you can add the ulimit command to the user’s startup script, such as the .bashrc or .profile file.

bannerAds