Skip to content

Instantly share code, notes, and snippets.

@ahmedelgabri
Last active December 29, 2015 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmedelgabri/7673970 to your computer and use it in GitHub Desktop.
Save ahmedelgabri/7673970 to your computer and use it in GitHub Desktop.
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 127.0.0.1 #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