SSH and Port Forwarding

(I) SSH with X. To simply get X over SSH, do
ssh -X name@machine xterm

(II) No X?   If you installed fedora with minimal package set, you may see:
$ ssh -YC remotebox                                    
[major@remotebox ~]$ xterm                              
xterm: Xt error: Can't open display:                    
xterm: DISPLAY is not set          
                                                       
source
(III) Simple Port Forwarding

Here we forward port 1143 on localhost to 143 (IMAP) on imap.example.com.
    ssh -f -N -q -L 1143:localhost:143 username@imap.example.com
  • -f tells ssh to go into the background (daemonize).
  • -N tells ssh that you don't want to run a remote command. That is, you only want to forward ports.
  • -q tells ssh to be quiet
  • -L specifies the port forwarding
Source: Main, Also