Suppose you are using R and have data stored in a data frame, M. Then I know that
R
M
g <- glm(Y ~ ., data=M)
wi
You can do two-way interactions simply using .*. and arbitrary n-way interactions writing .^n. formula(g) will tell you the expanded version of the formula in each of these cases.
.*.
.^n
formula(g)