Connect as deploy to server.example.test on TCP port 2222.
Which command is appropriate?
OpenSSH ssh uses lowercase -p PORT for the destination port. This differs from scp's uppercase -P option.
Detailed explanation
ssh -P 2222 deploy@server.example.testIncorrect. OpenSSH ssh does not use uppercase -P for this setting.
Incorrect. OpenSSH ssh does not use uppercase -P for this setting.
ssh -p 2222 deploy@server.example.testCorrect. It selects TCP port 2222 for the SSH connection.
Correct. It selects TCP port 2222 for the SSH connection.
ssh deploy@server.example.test:2222Incorrect. The colon form is associated with other tools, not ssh port selection.
Incorrect. The colon form is associated with other tools, not ssh port selection.
ssh --port=2222 deploy@server.example.testIncorrect. This is not the usual OpenSSH ssh port option.
Incorrect. This is not the usual OpenSSH ssh port option.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'ssh -p 2222 -> connect to remote TCP port 2222'Expected result
ssh -p 2222 -> connect to remote TCP port 2222Key points
- ssh uses lowercase -p
- Port 2222
- Distinguish scp -P
Notes
- Environment: OpenSSH client option対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.