Running bash script at background

# append & will run the script into background
./myscript &
# jobs will list background jobs
jobs
[1]+  Running ./myscript &
# fg [job number] will bring the job to foreground
fg 1
# Ctrl + z on a running script will suspend the job
# hit Ctrl + z
[1]+  Stopped ./myscript &
# To resume the job into background again
bg 1
# To completely terminate the job
# first back it to fg
fg 1
# then Ctrl + c

Leave a Reply