2

Can I execute a command in the foreground, by typing on the terminal the command?

e.g. command &

1
  • 2
    If you're happy with one or several of the answers, upvote them. If one is solving your issue, accepting it would be the best way of saying "Thank You!" Accepting an answer also indicates to future readers that the answer actually solved the problem.
    – Kusalananda
    Commented Nov 9, 2017 at 8:32

3 Answers 3

26

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).

12

The & tells it to run in the background. Remove it.

0
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .