# Scp in terminal to copy something from my laptop to a server

Hi I need to copy something from my laptop to a server. I tried using scp filename servername but it didn't work. I asked someone and he said I have to use -P but I don't know how. I tried several ways but all of them give
port 22: Connection refused. What can I do?
Thank you!

check to see if you can ssh into the device first.
$ssh [email protected] are you able to successfully ssh into the device? check to see if you can ssh into the device first.$ ssh [email protected]

are you able to successfully ssh into the device?

NEW

Yes, I am able to connect, but I need to use ssh -p 4410 [email protected] I tried using -P and 4410 in scp command but it still didn't work.

Try the following
$scp -vP 4410 [email protected]:/path/to/file . I added the verbose option, hopefully we see where it's going wrong Try the following$ scp -vP 4410 [email protected]:/path/to/file .

I added the verbose option, hopefully we see where it's going wrong
Wait, so in this, where I specify the file I want to send, before or after -vP 4410? (I want to send the file from my computer to [email protected])

In that case
scp -vP 4410 /path/on/your/computer [email protected]:/destination/path/on/remote/system/

In that case
scp -vP 4410 /path/on/your/computer [email protected]:/destination/path/on/remote/system/
I get this
usage: scp [-12346BCEpqrv] [-c cipher] [-F ssh_config] [-i identity_file]

[-l limit] [-o ssh_option] [-P port] [-S program]

[[[email protected]]host1:]file1 ... [[[email protected]]host2:]file2

can you show me the command you are typing in?

can you show me the command you are typing in?

scp -vP 89418.txt [email protected] (username and ip-adr are the same i use for the ssh command which is working)

You have to specify the port number before the text file.

scp -vP 4410 89418.txt [email protected]

You have to specify the port number before the text file.

scp -vP 4410 89418.txt [email protected]
You mean 4410? Isn't is already before the text file?

yes, you didn't have it in your post.

yes, you didn't have it in your post.
Sorry I am a bit confused. What do you mean

scp -vP 89418.txt [email protected] (username and ip-adr are the same i use for the ssh command which is working)
The command you are using does not specify a destination port number. As a result, scp is using the default ssh port 22.

scp -vP 89418.txt [email protected]

Correct command
scp -vP 4410 89418.txt [email protected]:/path/to/destination/folder/

The command you are using does not specify a destination port number. As a result, scp is using the default ssh port 22.