简体   繁体   English

使用命令“elasticsearch”在任意目录的终端中运行 elasticsearch

[英]Run elasticsearch in terminal in any directory with command “elasticsearch”

On my previous Mac laptop I was able to run elasticsearch in terminal in any directory with the command "elasticsearch".在我以前的 Mac 笔记本电脑上,我可以使用命令“elasticsearch”在任何目录的终端中运行 elasticsearch。 Now I have to scroll to the elasticsearch install directory and run a particular file.现在我必须滚动到 elasticsearch 安装目录并运行特定文件。

Could someone help me set up a command so I can just type "elasticsearch" wherever I am, and the service will start to run, as it was previously?有人可以帮我设置一个命令,这样我就可以在任何地方输入“elasticsearch”,服务就会像以前一样开始运行?

You can simply create an alias in your mac profile( latest version of mac uses.zshrc ) like below.您可以简单地在您的 mac 配置文件( 最新版本的 mac uses.zshrc )中创建一个别名,如下所示。

Assuming you have installed Elasricsearch using the tar file as you mentioned you have to go to a particular dir(bin) in this case.假设您已经使用您提到的 tar 文件安装了 Elasricsearch,在这种情况下,您必须将 go 安装到特定的 dir(bin)。

alias elasticsearch='./path/to/bin/foler/elasticsearch'

Please note, you need to run source ~/.zshrc to make sure alias is loaded.请注意,您需要运行source ~/.zshrc以确保已加载别名。 Let me know if you face any issue, help to help further.如果您遇到任何问题,请告诉我,帮助进一步提供帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过命令浏览终端中的任何目录 - how to browse any directory in terminal by command 无法在mac终端上运行任何命令 - Unable to run any command on mac terminal 如何从任何目录的终端执行python命令行实用程序 - How to execute a python command line utility from the terminal in any directory Elasticsearch 无法在 OSX 上启动或运行 - Elasticsearch fails to start or run on OSX 无法在 rails 项目目录中运行任何命令 - Unable to run any command inside a rails project directory 执行任何终端命令时出现“No such file or directory”(由 VMware Fusion 引起) - Getting `No such file or directory` when executing any terminal command (caused by VMware Fusion) std::process::Command 无法在 macOS 上运行 hdiutil(挂载失败 - 没有此类文件或目录),但该命令在终端中运行时运行良好 - std::process::Command cannot run hdiutil on macOS (mount failed - No such file or directory) but the command works fine when run in the terminal 在终端的新选项卡中运行命令 - Run a command in a new tab in terminal 通过xCode运行终端和命令 - Run terminal and command through xCode 如何在 Apple Silicon Mac 上运行 Elasticsearch 6? - How to run Elasticsearch 6 on an Apple Silicon Mac?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM