Is it possible somehow to source a specific bashfile right at the start of each ssh session on a foreign host? I have a file with just aliases that I want to use on foreign hosts as well as on my local machine. Now I'm fully aware that not all commands might be available on the foreign host, still my aliases usually only wrap very basic things like ls -al | grep $1, so I think that there's no harm, however the internet tells me that I always need to create a seperate .bashrc file on every host (which I can't or won't do because the whole company uses the same user on the external machine and I don't want to force my aliases up anyone's throat).
What's the least cumbersome way to achieve this?
Suppose your remote login shell is also Bash —
First, define this in your local Bash shell:
Next, save all your aliases (and other bashrc stuff) in a local file, say
myrcfile(suppose it's not too big):Then, run like this: