What do the commands 'bg' and 'fg' do in a Linux terminal?

093

In a Linux terminal, the commands bg and fg are used to manage background and foreground jobs.

  • bg: This command is used to resume a suspended job in the background. When you suspend a job (usually with Ctrl+Z), you can use bg to continue running it without occupying the terminal.

    Example:

    bg %1

    This resumes job number 1 in the background.

  • fg: This command brings a background job to the foreground, allowing you to interact with it directly in the terminal.

    Example:

    fg %1

    This brings job number 1 to the foreground.

You can list jobs using the jobs command to see their status and job numbers.

0 Comments

no data
Be the first to share your comment!