It depends on a lot of factors but normally you can stay in the house for at least a month or so, sometimes much longer, once Chapter 7 is filed. Each case is so different that no one can give you a precise answer. Each mortgage company has different rules and there are a lot of other factors that can also come into play.
That said, in a normal case, absent any very unusual circumstances, everyone involved in a foreclosure process attempts to work together to prevent any surprises and to give the homeowner a reasonable amount of time to voluntarily leave the property.