Connecting to Linux SSH using Windows Terminal

Connecting to Linux SSH using Windows Terminal

In later Windows, you can now use SSH from PowerShell

Windows Terminal / PowerShell


Open up Windows PowerShell, either in Terminal or directly

Connecting to server


Now you want to connect to your host

[snippet]#Command
ssh [username]@[ip-address]

#Example
ssh [email protected][/snippet]

If it's your first time connecting, you might be asked if you want to trust the connection. If you are sure it's the right server, enter yes to trust it

[snippet]The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
ECDSA key fingerprint is SHA256:bSZ2Q+jdiowøajdoijef2389jfer+tWK28A.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?[/snippet]

Next you'll be asked to enter your password

Congratulations, now you're connected to the server

Use other port than 22


If your server is not using the standard SSH port 22, then you need to define what port to use

[snippet]#Command
ssh [username]@[ip-address] -p [port-number]

#Example
ssh [email protected] -p 1234[/snippet]

Now you'll connect over port 1234, instead of port 22

Reconnecting


20230629_1001_649d193decbcd.webp

Next time you want to connect, just start typing SSH and you'll get a suggest for your last connection

If you want to reconnect, just press arrow left and it will be populated. Then press enter to connect as normal

Exiting connection


Once you're done, you can use exit or logoff

Sending single command


You can also send single commands, that will return result without leaving the connection open

[snippet]#Command
ssh [username]@[ip-address] [command]

#Example
ssh [email protected] ls[/snippet]

This will return a list of everything in default login directory

Sending multiple commands


You can also send multiple commands, that will return result without leaving the connection open

[snippet]ssh [username]@[ip-address] "[command-1]; [command-2]; [command-3]"[/snippet]

Here it's important that each command is ended with semicolon ; and that the entire command section is surrounded by double quotes "

Other options


If you're running an older versions of Windows or just don't want to use SSH in PowerShell. There are still other options, such as the classic Putty or installing a Linux distro onto your Windows, then connecting from there



Tags: #Windows #Linux #SSH

We sometimes publish affiliate links and these always needs to follow our editorial policy, for more information check out our affiliate link policy

You might also like

Comments

Sign up or Login to post a comment

There are no comments, be the first to comment.