Cook pasta in a large pot of salted boiling water according to package directions.
Heat oil in a medium sauté pan over medium heat. Then add the garlic and onions, salt and pepper and sauté for about 2-3 minute. Then add the sliced mushrooms, salt and pepper and sauté about 2 minutes
Drain pasta and toss with mushrooms, garlic and onions.