Bash Bring a background process to the foreground


$ fg %2
sleep 600

%2 specifies job no. 2. If fg is used without any arguments if brings the last process put in background to the foreground.

$ fg %?sle
sleep 500

?sle refers to the baground process command containing "sle". If multiple background commands contain the string, it will produce an error.