How to run bash command in background

If you want to run a bash command in the background you can append a & (ampersand) sign at the end of the command.


<command> &


% sleep 50 & 
[1] 38841
[1]  + done       sleep 5

As you can see, I ran the sleep command for 50 seconds with a & sign, this causes the command to run in the background of the Terminal and the prompt is returned where you can run other commands.

As soon as the background task is completed, you get the details that the command is completed.

[1]  + done       sleep 5

[1] 38841 indicates that the background job has been started and its job number is [1] and a process ID (PID) 38841.

Run Bash command in Terminal Background Example

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap