Optical S/PDIF-Out
This port is used to connect home theater and high-fidelity audio equipment. It can transmit a 2-channel uncompressed audio signal or compressed 5.1/7.1 channel audio. These ports typically use a fiber optic TOSLINK (short for ToshibaLink) cable or special RCA cables. S/PDIF has largely been replaced by HDMI so don’t be surprised if you don’t use this one.
PS/2
Named after the IBM Personal System/2 series of computers on which it was first introduced, the PS/2 port has been used to connect keyboards and mice since the late 1980s. Older computers may be equipped with two of these ports, one each for the keyboard (purple) and mouse (green). Some computers will have a combined PS/2 port that is half purple/half green, this utilizes a special splitter cable to connect both a keyboard and mouse to the same port. Most modern computers do not have a PS/2 port as they have been almost entirely replaced by the more capable USB port.
VGA
Usually blue in color, the Video Graphics Array or VGA port was also introduced on the IBM Personal System/2 series in 1987 to transmit analog video. Having been cloned by nearly every PC manufacturer ever since, it is by far the most common port across all personal computers. This port is used to connect most monitors and other displays, although with the advent of higher-resolution displays it too is being replaced.
DVI
Typically white in color, the Digital Visual Interface was designed to transmit uncompressed digital video with the ability to include analog signal as well. While the main shape of DVI connections are the same, the internal pin configuration can vary depending on what capabilities are being used. Don’t worry, while there are variations, you won’t be able to cross connect them.
USB
The Universal Serial Bus is one of the most common ports on a computer. Although primarily black, newer USB 3.0 ports are sometimes blue or yellow. USB was designed to be a common interface for PC peripherals like keyboards, mice, printers, scanners, external drives, etc. that provides both a data connection as well as power. USB ports can only be oriented one way so you won’t be able to plug in unless it's positioned correctly. USB ports are also interchangeable so you don’t need to connect to the same USB port with the same device every time. While there are different speed and power ratings for USB (1.0, 2.0 HighSpeed and 3.0 SuperSpeed) all are interchangeable.
HDMI
The High Definition Multimedia Interface port is used to transmit uncompressed video and audio signals and is always black. As with DVI there are many different versions of HDMI but unlike DVI they all use the same cable design although there are different specifications that support newer features such as 3D video. If you are connecting to a 3D capable display or other higher-spec device you may want to use a newer HDMI cable as some of these features can’t be transmitted over older cables even though the connections are the same.
1394 or FireWire
FireWire was developed by Apple in 1999 and is most often compared to USB since they perform the same function of connecting peripherals to computers. FireWire is often red, black or orange in color although this is primarily stylistic. FireWire never gained the same ground as USB (despite connecting a broader range of devices) and is not often seen on modern computers.
eSATA
External Serial ATA ports are primarily used to connect external storage devices such as external hard drives and are usually red or black. While eSATA was initially faster than FireWire and USB, it hasn’t captured much of the peripherals market and is often not included.
LAN
The Local Area Network port is what is colloquially known as “the Internet” port because this is how most computers (desktops especially) connect to a DSL or cable modem to access the Internet. Also called an Ethernet port, (due to Ethernet being the common implementation of LAN connections) this is how your computer connects to and communicates with other computers. Although other options exists, (such as Wifi or fiber optics) the LAN port remains one of the most frequently used ports on modern computers.
Line Out or 3.5MM
These little ports are where you connect your speakers or headphones. Unless you’re running more than 2 speakers you will only use the green colored port. If you have a surround sound system then simply match the colors of the cable ends to the ports on the computer. Microphones always connect to the pink port.
In the end, this is what is important. If something fits in a particular port then that one is fine to use for that connection. If it doesn’t fit, find the one it matches and you’re good to go. Any that have multiple ports that look the same are ones where you can use any of the ports interchangeably with any connection.