📜  ssh list port forwards - Shell-Bash (1)

📅  最后修改于: 2023-12-03 15:20:20.179000             🧑  作者: Mango

SSH List Port Forwards

The ssh list port forwards command is a Unix/Linux shell command that allows programmers to view the currently active SSH port forwards for a particular SSH connection.

Syntax
ssh list port forwards [user@]hostname

Where user and hostname are both optional parameters. If no user is specified, the current user will be used. If no hostname is specified, the local hostname will be used.

Output Format

The ssh list port forwards command returns a list of currently active SSH port forwards in the following format:

LocalHostName:LocalPort       RemoteHostName:RemotePort

Each line in the output represents one active SSH port forward. The LocalHostName and LocalPort columns represent the local machine and port that the SSH connection is forwarding traffic to. The RemoteHostName and RemotePort columns represent the remote machine and port that the SSH connection is forwarding traffic from.

Here is an example output:

localhost:8080      example.com:80
localhost:5432      example.com:5432
Additional Options

There are several additional options that can be used with the ssh list port forwards command:

  • -v: Enables verbose output, showing additional information about each forward including the process ID and timestamp of when the forward was created.

  • -N: Disables running any command on the remote host, which can be useful in situations where a connection needs to be established without running any remote commands.

  • -i: Specifies the location of the private key file to be used for authentication.

Conclusion

The ssh list port forwards command is a useful tool for programmers to view active SSH port forwards for a particular SSH connection. With the additional options available, programmers can further customize their output to better suit their needs.