sudo: ulimit: command not found

简介:

ulimit is a shell builtin like cd, not a separate program. sudo looks for a binary to run, but there is no ulimit binary, which is why you get the error message. You need to run it in a shell.
However, while you do need to be root to raise the limit to 65535, you probably don’t want to run your program as root. So after you raise the limit you should switch back to the current user.
To do this, run:
sudo sh -c "ulimit -n 65535 && exec su $LOGNAME"
and you will get a new shell, without root privileges, but with the raised limit. The exec causes the new shell to replace the process with sudo privileges, so after you exit that shell, you won’t accidentally end up as root again.

sudo 查看ulimit报错:
google 百度,翻译都太拗口,简洁的说:

ulimit是一个shell内置的命令 像cd ,不是一个独立的进程,sudo以二进制方式运行,但是没有ulimit的二进制方式,所以你运行错误。 应该在一个shell中运行。

本文转自    憬薇   51CTO博客,原文链接:http://blog.51cto.com/welcomeweb/2044982


相关文章
|
开发工具
成功解决 zsh: command not found
成功解决 zsh: command not found
2831 0
|
Shell Linux
Centos7:“Entering emergency mode. Exit the shell to continue”错误解决方法
想过很多朋友有遇到这种情况,就是正在远程使用centos7系统时,一旦让远程虚拟机或服务器断电或强制关机,那么再次重启时就会出现“Entering emergency mode. Exit the shell to continue.”的错误。
11852 1
Centos7:“Entering emergency mode. Exit the shell to continue”错误解决方法
Command ‘nohub‘ not found, did you mean: command ‘nohup‘ from deb coreutils (8.32-4.1ubuntu1)
Command ‘nohub‘ not found, did you mean: command ‘nohup‘ from deb coreutils (8.32-4.1ubuntu1)
|
Shell
bash: accelerate: command not found
bash: accelerate: command not found
2671 3
Gulp zsh: command not found: gulp
Gulp zsh: command not found: gulp
151 0
How to Fix “firewall-cmd: command not found” Error in ubuntu
How to Fix “firewall-cmd: command not found” Error in ubuntu