Run one command through ssh connection and exit
Simply enough you just have to append command to ssh:
ssh admin@example.com ps -eaf
Written by Adam Stankiewicz
Related protips
3 Responses
in this case /bin/bash doesn't do its full "login" procedure. do you know how to fix it?
over 1 year ago
·
Yes. .bash_profile will be sourced in a terminal session; .bashrc is run in a shell. Anything that needs to get executed for your one-liner needs to be in .bashrc.
over 1 year ago
·
and you can chain remote commands with ";"? or will those be treated as local shell commands as opposed to commands to run via SSH? i.e. the question is what if you wanted to run a set of commands thru SSH in a single line (as opposed to multiple SSH calls or putting everything in a shell script and running that script as command with SSH).
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ssh
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#