年前最后一场技巧盛宴 | 1月27日与京东、日记易技巧大年夜咖畅聊智能化运维成长趋势!
我在长途主机上上设置过一个叫做 file_repl 的 bash 别号 。当我应用 ssh 敕令登录长途主机后,可以很正常的应用这个别号。然而这个 bash 别号却无法经由过程 ssh 来运行,像如许:
我要如何做才能经由过程 ssh 敕令运行 bash 别号呢?
$ ssh vivek@server1.cyberciti.biz file_repl
bash:file_repl:command not found
SSH 客户端 (ssh) 是一个登录长途办事器并在长途体系上履行 shell 敕令的 Linux/Unix 敕令。它被设计用来在两个非信赖的机械上经由过程不安然的收集(比如互联网)供给安然的加密通信。
若何用 ssh 客户端履行敕令
经由过程 ssh 运行 free
敕令或 date 敕令 可以如许做:
$ ssh vivek@server1.cyberciti.biz date
结不雅为:
或者:
$ type -a date
date is /bin/date
$ type -a free
free is /usr/bin/free
$ command -V pwd
pwd is a shell builtin
$ type -a file_repl
is aliased to `sudo -i /shared/takes/master.replication'
$ ssh -t user@remote /bin/bash -ic 'your-alias-here'
$ ssh -t user@remote /bin/bash -ic 'file_repl'
$ ssh vivek@server1.cyberciti.biz free -h
结不雅为:
total used free shared buff
推荐阅读
年前最后一场技巧盛宴 | 1月27日与京东、日记易技巧大年夜咖畅聊智能化运维成长趋势! 碰到过很多同业、客户问>>>详细阅读
本文标题:通过ssh会话执行bash别名
地址:http://www.17bianji.com/lsqh/40432.html
1/2 1