Can I execute a command in the foreground, by typing on the terminal the command?
e.g. command &
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityCan I execute a command in the foreground, by typing on the terminal the command?
e.g. command &
If you drop the &
the command will run in the foreground:
command
If you want to bring a background command to the foreground, run
fg
You can specify a “jobspec”, for example
fg %2
will bring job number 2 to the foreground (jobs
will list the job table).
The command with & brings it in background. if you type a command without &, you can bring it in background with:
CTRL+Z
bg
If you want to go back to foreground, type
fg