(cmd &) | (timeout --foreground 2 cat; cat > /dev/null &)
Would show you the output of `cmd` for 2 seconds and then return, with `cmd` running in background with its output going to `/dev/null`.
You can redirect that to a file or store in a variable with:
var=$(that command)