Metagenome of gut microbes has been implicated in metabolism, immunity, and health maintenance of its host. However, in most of previous studies, the microbiota was sampled from feces instead of gastrointestinal (GI) tract. In this study, we compared the microbial populations from feces at four different developmental stages and contents of four intestinal segments at maturity to examine the dynamic shift of microbiota in pigs and investigated whether adult porcine fecal samples could be used to represent samples of the GI tract. Analysis results revealed that the ratio of Firmicutes to Bacteroidetes from the feces of the older pigs (2-, 3-, 6- month) were 10 times higher compared to those from piglets (1-month). As the pigs matured, so did it seem that the composition of microbiome became more stable in feces. In adult pigs, there were significant differences in microbial profiles between the contents of the small intestine and large intestine. The dominant genera in the small intestine belonged to aerobe or facultative anaerobe categories, whereas the main genera in the large intestine were all anaerobes. Compared to the GI tract, the composition of microbiome was quite different in feces. The microbial profile in large intestine was more similar to feces than those in the small intestine, with the similarity of 0.75 and 0.38 on average, respectively. Microbial functions, predicted by metagenome profiles, showed the enrichment associated with metabolism pathway and metabolic disease in large intestine and feces while higher abundance of infectious disease, immune function disease, and cancer in small intestine. Fecal microbes also showed enriched function in metabolic pathways compared to microbes from pooled gut contents. Our study extended the understanding of dynamic shift of gut microbes during pig growth and also characterized the profiles of bacterial communities across GI tracts of mature pigs.