Are you using a Mac? Tired of typing long commands with many parameters again and again? Well, you can define aliases.
This recipe is used in courses IDATA2301 Web technologies and IDATA2306 Application Development at NTNU, campus Aalesund.
Instructions:
ssh -i ~/.ssh/my-secret-key.pem ubuntu@my-server-ip
~/.zshrc
. You need to
edit that file and put your aliases there. To edit the file, run the
following command in the terminal:
nano ~/.zshrc
alias youraliasname='the code you want to execute'For example, if you want to make a shortcut named
ssh-into-server
which will execute the command
ssh -i ~/.ssh/my-secret-key.pem ubuntu@my-server-ip
, then
you add the following line to the file:
alias ssh-into-server='ssh -i ~/.ssh/my-secret-key.pem ubuntu@my-server-ip'
That's all, Folks!
From now on you can use the ssh-into-server
command instead
of the long command with all the parameters.