我将远程服务器的端口转发到本地 mac,如下所示:
ssh -L 15672:localhost:15672 [email protected]
当我在 shell 中执行此操作时,我也会登录到 example.com。但我希望命令返回而不占用我的外壳。
有没有办法做到这一点?
答案1
您应该添加-N
以避免在远程获取 shell,并-f
在关闭 shell 时将进程移动到后台而不会丢失它。
我将远程服务器的端口转发到本地 mac,如下所示:
ssh -L 15672:localhost:15672 [email protected]
当我在 shell 中执行此操作时,我也会登录到 example.com。但我希望命令返回而不占用我的外壳。
有没有办法做到这一点?
您应该添加-N
以避免在远程获取 shell,并-f
在关闭 shell 时将进程移动到后台而不会丢失它。