In the past I have used rescue time from https://www.rescuetime.com/
It lets you mark any program or website either as productive or non productive on a five point scale.
Then you can enable focus mode and it will disallow you any of the non productive things you do.
Also it gives you great insight in where you are spending your time, for example you can see if those e-mails really take that much of your time away.
Using tools like this is said to improve your productivity about 15% just by creating awareness you are going to be more focused.
The linux integration is not official supported and not so good at the time, but it works really good on a Mac or Windows. Also on multiple machines or virtual machines at the same time. I think they also have mobile clients.
And as others have suggested try to become a advanced user of the pomodoro technique: http://www.pomodorotechnique.com/download/pdf/ThePomodoroTechnique_v1-3.pdf