Surgery of the gastrointestinal tract can result in deep changes among the gut commensals in terms of abundance, function and health consequences. Elective colorectal surgery can occur for neoplastic or inflammatory bowel disease; in these settings, microbiota imbalance is described as a preoperative condition, and it is linked to post-operative complications, as well. The study of bariatric patients led to several insights into the role of gut microbiota in obesity and after major surgical injuries. Preoperative dysbiosis and post-surgical microbiota reassessment are still poorly understood, and they could become a key part of preventing post-surgical complications. In the current review, we outline the most recent literature regarding agents and molecular pathways involved in pre- and post-operative dysbiosis in patients undergoing gastrointestinal surgery. Defining the standard method for microbiota assessment in these patients could set up the future approach and clinical practice.