在这看到的:http://stackoverflow.com/questions/17483723/command-not-found-when-using-sudo-ulimit

修改系统文件打开数,具体修改方法就不写了,但是在普通用户使用sudo执行的时候报错:

130> sudo ulimit
sudo: ulimit: command not found 本来以为ulimit没在path变量中,用绝对路径就行了:
1> which ulimit
/usr/bin/which: no ulimit in (/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin) 查了下原因ulimit不是一个单独的程序。sudo会去找二进制文件运行。由于找不到ulimit的二进制可执行文件,故报错。 类似的命令还有:cd 可以这样设置:
sudo sh -c "ulimit -n 65535 && exec su $LOGNAME" 该命令创建一个新的shell,然后设置ulimit,同时将用户切换至当前用户,当命令退出时,不会是以root权限退出。 英语解释:
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. 你将得到一个新的shell,没有root权限,但是提高了限制。 exec使新shell以sudo权限替换进程,所以在你退出shell之后

sudo: ulimit: command not found的更多相关文章

  1. Ubuntu解决sudo: source: command not found错误

    Ubuntu Server上执行以下命令,可以看到默认打开的文件数限制为1024个. $ ulimit -n 1024 编辑/etc/profile配置文件,在最后添加一行: ulimit -SHn ...

  2. 示sudo: cd: command not found

    执行sudo cd 时出现 sudo: cd: command not found 原因shell shell是一个命令解析器 所谓shell是一个交互式的应用程序. shell执行外部命令的 时候, ...

  3. [问题解决]linux sudo xxx:command not found

    题外话 软件的安装在linux下主要分为两种.一种是通过包管理器例如ubuntu的apt-get xxx,另一种是自己手动安装.通过包管理器安装的,基本开箱即用,无需配置,但是存在一个问题,有时候无法 ...

  4. sudo: cd: command not found

    事件起因 今天在aws ubutun上忽然发现的一个问题,执行sudo cd 时出现 sudo: cd: command not found 原因 shell shell是一个命令解析器 所谓shel ...

  5. 解决:sudo: pip: command not found

    1-问题:Ubuntu下执行sudo pip install package-name 出现 sudo: pip: command not found 的问题. 2-原因:编译sudo的时候加入了–w ...

  6. Mac 显示sudo: pip: command not found

    Mac显示sudo: pip: command not found mac在安装完pip模块后,使用pip命令会提示sudo: pip: command not found moyanzhudeMac ...

  7. sudo: add-apt-repository: command not found

    错误来啦:sudo: add-apt-repository:command not found      网上解决办法是直接安装工具包 命令:sudo apt-get install python-s ...

  8. sudo: java: command not found

    背景:搭建了jumpserver,给开发划分了所有权限,但是开发那边账户不能执行java命令 报错:sudo: java: command not found 解决方法: 在用户管理权限配置sudoe ...

  9. Ubuntu 提示sudo: java: command not found解决办法

    ubuntu下运行sudo Java 时提示“sudo: java: command not found”.在网上找了,其中很多方法都提示要修改/etc/profile的配置,或是修改/etc/env ...

随机推荐

  1. hive引擎的选择:tez和spark

    背景 mr引擎在hive 2中将被弃用.官方推荐使用tez或spark等引擎. 选择 tez 使用有向无环图.内存式计算. spark 可以同时作为批式和流式的处理引擎,减少学习成本. 问题& ...

  2. 安装keepalived OpenSSL is not properly installed on your system. !!!

    错误信息: configure: error: !!! OpenSSL is not properly installed on your system. !!! !!! Can not includ ...

  3. bootstrap table使用colResizable后表格不能自适应

    窗口缩小放大后,b表格不能自适应,table加了宽度没效果,求教

  4. 深入理解JVM,类加载器

    虚拟机设计团队把类加载阶段中的“通过一个类的全限定名来获取描述此类的二进制字节流(即字节码)”这个动作放到Java虚拟机外部去实现,以便让应用程序自己决定如何去获取所需要的类.实现这个动作的代码模块称 ...

  5. android studio 菜单中的app运行按钮上有个叉号,原因与解决办法(自己去百度)

    http://blog.csdn.net/sz0268/article/details/51706397 : 在Android studio写代码中,直接建立项目,写代码然后运行是不会一般是不会出现这 ...

  6. js获取当前日期一年的第几周

    获取当前日期一年中的第几周 function theWeek() { ; now = new Date(); years = now.getYear() ) years += ); days[] = ...

  7. java笔记----cpu消耗快速定位代码

    下载ProcessExplorer ProcessExplorer下载地址:ProcessExplorer 下载运行代码 打开ProcessExplorer 查看javaw.exe的pid jstac ...

  8. npm命令集合

    1.npm初始化项目:npm init 或者 npm init --yes 生产 package.json文件 2.下载package.json安装包: npm install 缩写 npm i

  9. Python的包package的导入与被导入(包的类和方法的导入,__init__()怎么写)

    包package的导入与被导入: 参考一下: https://blog.csdn.net/guowujun321/article/details/80764468 1.文件目录: | |--  A/ ...

  10. [b0042] python 归纳 (二七)_gui_tkinter_基本使用

    # -*- coding: utf-8 -*- """ 学习 Tkinter画图基本控件使用 逻辑: 放几个 输入控件.点击按钮,将输入控件内容打印出来 使用: 1. 创 ...