This question already has an answer here:
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
- without tinkering with remote machines's
Following would just execute the alias commands in a non-interactive shell on remote machine and terminate the session (as expected):
kashyap@Laptop$ ssh firstname.lastname@example.org "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.
ssh usr@remote --init-script=/local/my_init_script_for_ssh_sessions