I need to keep ssh'ing into many-different Linux boxes (Ubuntu mostly) and every time I miss my basic aliases. Is there a way to setup aliases etc
- while opening an interactive
ssh
a machine - without tinkering with remote machines's
.bashrc/.bash_profile
?
Following would just execute the alias commands in a non-interactive shell on remote machine and terminate the session (as expected):
kashyap@Laptop$ ssh root@ec2-1-2-3-4.compute-6.amazonaws.com "alias c=clear; alias p=pwd; alias l='ls -altr'
I would love it if I could select a file from local machine to be executed as init script on remote, but willing to settle for less.
E.g.
ssh usr@remote --init-script=/local/my_init_script_for_ssh_sessions
LocalCommand
doesn't have access to the session and is run locally. – RealSkeptic Apr 11 '16 at 20:39ssh
, not on the machine where you runsshd
. Try usinghostname
as yourLocalCommand
and see on which host in executes. – RealSkeptic Apr 11 '16 at 20:50