Breaking Bad Habits

Hey guys, i wanted to ask you, how i can break my bad habits? for example, when i come home from school, i sit at the pc immediately.. like for hours without getting up a single time. Or i eat when I'm sad etc. :/ hope you guys can give me some tips ~