ifconfig : 命令“ifconfig”在“/sbin/ifconfig”中可用

Sah*_*ver 6 command-line ifconfig paths

我的问题与另一个悬而未决的问题有关。我的 echo $PATH 给了我一个输出,就像

/home/sahil/.rvm/gems/ruby-1.9.3-p125/bin:/home/sahil/.rvm/gems/ruby-1.9.3-p125@global/bin:/home/sahil/.rvm/rubies/ruby-1.9.3-p125/bin:/home/sahil/.rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/games:/home/sahil/.rvm/bin{}:/home/android-sdks/{}:/home/android-sdks/platform-tools/{}:/home/android-sdks/tools/{}:/home/sahil/android-sdks/tools{}:/home/sahil/android-sdks/tools:/home/sahil/android-sdks/platform-tools/
Run Code Online (Sandbox Code Playgroud)

但是跑步

ifconfig 
Run Code Online (Sandbox Code Playgroud)

给我一个输出

Command 'ifconfig' is available in '/sbin/ifconfig'
The command could not be located because '/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
ifconfig: command not found
Run Code Online (Sandbox Code Playgroud)

在运行其他问题中给出的命令后

export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
Run Code Online (Sandbox Code Playgroud)

它运行ifconfig但阻止 ruby​​ rails 或 rvm 的其他命令。

寻求帮助如何解决这个问题。还有为什么会这样?

Man*_*tha 8

试试下面的命令

export PATH=$PATH:/usr/sbin
Run Code Online (Sandbox Code Playgroud)

或(如果要设置所有路径)

export PATH=$PATH:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games
Run Code Online (Sandbox Code Playgroud)

  • 编辑完 rc 文件后,我通常输入 `source ~/.rcFileName` 来重新加载更改。 (3认同)

Rin*_*ind 1

您的原文$PATH(您发布的行不太可读):

/home/sahil/.rvm/gems/ruby-1.9.3-p125/bin:
/home/sahil/.rvm/gems/ruby-1.9.3-p125@global/bin:
/home/sahil/.rvm/rubies/ruby-1.9.3-p125/bin:/home/sahil/.rvm/bin:
/usr/local/bin:/usr/bin:/bin:/usr/games:
/home/sahil/.rvm/bin{}:
/home/android-sdks/{}:
/home/android-sdks/platform-tools/{}:
/home/android-sdks/tools/{}:
/home/sahil/android-sdks/tools{}:
/home/sahil/android-sdks/tools:
/home/sahil/android-sdks/platform-tools/
Run Code Online (Sandbox Code Playgroud)

你有/usr/local/bin/usr/bin并且/bin。正如您已经发现的ifconfig那样/sbin

因此,在设置该路径的位置,您还需要包含/sbin.

请参阅ruby​​gems文档了解如何执行此操作。