Wednesday 11 September 2013

Executing Background Jobs in Linux

Manage Background Jobs in Linux

when you execute a find command that might take a lot time to execute, you can put it in the background as shown below.

Appending an ampersand ( & ) to the command runs the job in the background.

     find / -type f -mtime -1000 >> /root/filelist.log &

Sending the current foreground job to the background using Ctrl + Z.

     find / -type f -mtime -1000 >> /root/filelist.log
     Ctrl + Z

Taking a job from the background to the foreground.

     find / -type f -mtime -1000 >> /root/filelist.log
     Ctrl + Z

View all the background jobs.


     [1]+  Stopped    find / -type f -mtime -1000 >> /root/filelist.log

Kill a specific background job.

     fg %1
     kill %1


No comments:

Post a Comment