如何从终端打开谷歌浏览器? [英] How to open google chrome from terminal?

查看:134
本文介绍了如何从终端打开谷歌浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个将Google chrome打开到本地主机的别名.在这种情况下,端口为80.

I'm trying to create an alias that opens google chrome to localhost. Port 80 in this case.

我也非常希望能够位于任何git目录中,并使其在浏览器中打开该特定项目,但是我不确定是否有可能.

I'd also really like to be able to be in any git directory and have it open that specific project in the browser, but I'm not sure if that's even possible.

  • 如何从终端打开谷歌浏览器?
  • 我可以使用什么别名在浏览器中打开当前的git项目?

更多详细信息:

  1. 我的本地主机设置为端口80.
  2. 我将git存储库存储在〜/Sites/中-这意味着如果我想在浏览器中查看任何项目,都可以在以下位置找到: http://localhost/FILENAME

谢谢

推荐答案

更新:

  1. 如何从终端打开谷歌浏览器?

感谢您的快速回复. open http://localhost/在Mac上的默认浏览器中打开了该域.

Thank you for the quick response. open http://localhost/ opened that domain in my default browser on my Mac.

  1. 我可以使用什么别名在浏览器中打开当前的git项目?

我最终写了这个别名,完成了窍门:

I ended up writing this alias, did the trick:

# Opens git file's localhost; ${PWD##*/} is the current directory's name
alias lcl='open "http://localhost/${PWD##*/}/"'

再次感谢您!

这篇关于如何从终端打开谷歌浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆