Run a remote command
Run a command over SSH without an interactive shell
ssh user@host 'sudo systemctl status nginx'
More ssh commands
-
scp -r -P 2222 ./dist/ user@host:/var/www/app/Copy recursively to a server on a non-standard port
-
ssh -A user@bastionForward your local SSH agent to the remote host; use with care
-
eval $(ssh-agent) && ssh-add ~/.ssh/id_ed25519Start the agent and load a key for this session
-
cat >> ~/.ssh/config <<'EOF' Host dev HostName 10.0.0.5 User ubuntu IdentityFile ~/.ssh/dev_key ProxyJump bastion EOFShort alias: "ssh dev" applies all these options
-
~.Press Enter, then type ~ and . to close a hung session