I installed Ubuntu 16.04 alongside Linux mint 18.
I installed of plenty softwares, changed path variables and many other things that made my Ubuntu messy.
I need to restore Ubuntu as before. So, i want to format Ubuntu partition to make it new again (as fresh OS after installation). How can I do it through terminal or some other means without installing OS again?
There's no practical way to restore a "well used" Ubuntu partition to its original "just installed" state, short of reinstalling Ubuntu -- and if there were, it would likely take longer than just installing Ubuntu fresh.
The one potential exception to this is if you made a complete "image" backup of your Ubuntu immediately after installation -- in which case, restoring that "image" of both / and /home would put Ubuntu back to "freshly installed" condition.