Linux aliases are cool


Even if I have been using Linux for a long time, I didn't use alias before and it's so cool !


In general you are right. I've used aliases a lot. Mostly for specific ssh connections.

alias sslucy="ssh -p 1025 -4 -i /media/bm/keys/ssh_lucy.priv "
alias sslea="ssh -p 1026 -4 -i /media/bm/keys/ssh_lea.priv "
alias sszoe="ssh -p 1027 -4 -i /media/bm/keys/ssh_zoe.priv "

But when I'm not home, i always forgot what port is connected to which host. So I gave it up.
And this is a problem with every alias, you'll forget what is behind.


what is the -4 doing ?
for the other I understand ( port and certificate/key)


Yes, the number-options are confusing sometimes.

-1 ' Forces ssh to try protocol version 1 only.
-2 ' Forces ssh to try protocol version 2 only.
-4 ' Forces ssh to use IPv4 addresses only.
-6 ' Forces ssh to use IPv6 addresses only.

Source: ssh(1): OpenSSH SSH client - Linux man page

I am preferring something like --proto (1|2) and --ip (4|6) as well, for better understanding. But on the other hand it is shorter and easy to remember instead of 'is proto for ssh or ip?', 'is it protocol or just proto?' and so on.

1 Like