# Mastering SSH from basic login to port forwarding for remote access:
# Learn how to connect to custom SSH port, use identity keys, run remote commands, forward ports for database access with these practical examples
xinit@localhost:~$ # Basic SSH connection:
xinit@localhost:~$ ssh user@remote-address
xinit@localhost:~$ # Connect with a custom port (e.g., 2222):
xinit@localhost:~$ ssh user@remote-address -p 2222
xinit@localhost:~$ # Connect using a specific private key:
xinit@localhost:~$ ssh -i ~/.ssh/private_key user@remote-address
xinit@localhost:~$ # Run a single command on a remote host:
xinit@localhost:~$ ssh user@remote-address "df -h"
xinit@localhost:~$ # Forward a remote port to your local machine (runs in background):
xinit@localhost:~$ # Usage: Access localhost:5432 to connect to remote_host:5432
xinit@localhost:~$ ssh -fNL 5432:localhost:5432 user@remote-address