How do I execute a remote alias over an SSH?
For instance, there is a rather complex alias for rkhunter
, and I would like to execute it in one command over ssh
like that:
ssh user@server_ip -p port_number -t alias_name_defined_on_server
To be exact, the alias is defined in .bash_aliases
which is sourced by .bashrc
of this particular user
.
Best Answer
A working answer was published in SO, quoted below:
Note: If your
~/.bashrc
hold something like the below, comment the line thatreturn
when the shell is not interactive: