Linux:已安装 Curl 但 -bash: :curl: 命令未找到
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/55600523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Linux: Curl installed but -bash: :curl: command not found
提问by Chase Westlye
Running Debian Stretch on an r710. Using the non-free/contrib build for driver support.
在 r710 上运行 Debian Stretch。使用非自由/贡献构建来支持驱动程序。
When I try to use packages that I've installed (curl, zpool, etc), I have to include the path to the package... Which is a pain when I don't always know where packages install to.
当我尝试使用我已经安装的包(curl、zpool 等)时,我必须包含包的路径......当我并不总是知道包安装到哪里时,这很痛苦。
Two questions:
两个问题:
- How do I remedy the path issue in the short term?
- How do I amend Debian so that when packages are installed, their paths update/install automatically?
- 如何在短期内解决路径问题?
- 如何修改 Debian,以便在安装软件包时,它们的路径会自动更新/安装?
回答by wuseman
Find where the command is stored by
查找命令的存储位置
which <command>
Either you can try run curl from the output above for example /usr/bin/curl then try execute this:
您可以尝试从上面的输出中运行 curl 例如 /usr/bin/curl 然后尝试执行此:
/usr/bin/curl
For a temporary fix until you solve the real problem you can do:
对于临时修复,直到您解决真正的问题,您可以执行以下操作:
cd /usr/local/bin; ln -s $(which curl) curl
Or you can just set an alias:
或者你可以只设置一个别名:
echo "alias curl='$(which curl)'" >> ~/.bashrc; . ~/.bashrc
Troubleshoot your problem:
解决您的问题:
Check so PATH folder has the correct paths exported:
检查 PATH 文件夹是否导出了正确的路径:
printf "%s\n" $PATH
Modify current PATH
修改当前路径
Use the export command to add new paths and see if that works you can then update your ~/.bashrc or ~/.bash_profile, but first you can try in shell without adding it permanent to $PATH
使用导出命令添加新路径并查看是否有效,然后您可以更新您的 ~/.bashrc 或 ~/.bash_profile,但首先您可以尝试在 shell 中不将其永久添加到 $PATH
export PATH=$PATH:/missed/bin/folder
To format your PATH variable for easy viewing in future you can add below function to your .bashrc
要格式化您的 PATH 变量以便将来轻松查看,您可以将以下函数添加到 .bashrc
function path(){
old=$IFS
IFS=:
printf "%s\n" $PATH
IFS=$old
}