In this paper we describe the Nearby Optical Galaxy (NOG) sample, which is a complete, distance-limited ($czleq$6000 km/s) and magnitude-limited (B$leq$14) sample of $sim$7000 optical galaxies. The sample covers 2/3 (8.27 sr) of the sky ($|b|>20^{circ}$) and appears to have a good completeness in redshift (98%). We select the sample on the basis of homogenized corrected total blue magnitudes in order to minimize systematic effects in galaxy sampling. We identify the groups in this sample by means of both the hierarchical and the percolation {it friends of friends} methods. The resulting catalogs of loose groups appear to be similar and are among the largest catalogs of groups presently available. Most of the NOG galaxies ($sim$60%) are found to be members of galaxy pairs ($sim$580 pairs for a total of $sim$15% of objects) or groups with at least three members ($sim$500 groups for a total of $sim$45% of objects). About 40% of galaxies are left ungrouped (field galaxies). We illustrate the main features of the NOG galaxy distribution. Compared to previous optical and IRAS galaxy samples, the NOG provides a denser sampling of the galaxy distribution in the nearby universe. Given its large sky coverage, the identification of groups, and its high-density sampling, the NOG is suited for the analysis of the galaxy density field of the nearby universe, especially on small scales.