Skip to content

Instantly share code, notes, and snippets.



Last active Dec 29, 2015
What would you like to do?
How can I run a bash alias on a server from my local machine?

On my laptop

Inside ~/.ssh/config file I have this

Host <serverAlias>
    HostName #Server IP
    User <username>
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa

On the server

Inside ~/.bashrc I have this alias alias runcomman="ls -al"

What I want to do is

In my terminal I want to type ssh <serverAlias> <something> to ssh into the server & run the alias on the server, so how can I do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment