gmx distance calculates distances between pairs of positions as a function of time. Each selection specifies an independent set of distances to calculate. Each selection should consist of pairs of positions, and the distances are computed between positions 1-2, 3-4, etc.
-oav writes the average distance as a function of time for each selection. -oall writes all the individual distances. -oxyz does the same, but the x, y, and z components of the distance are written instead of the norm. -oh writes a histogram of the distances for each selection. The location of the histogram is set with -len and -tol. Bin width is set with -binw. -oallstat writes out the average and standard deviation for each individual distance, calculated over the frames.