Multitasking in the Terminal

I’ve always sat watching the terminal without any other option after getting my system into some time consuming jobs like creating a .iso file from a CD and the like.
Yeah there is always the option of opening another terminal and doing whatever you want in the meantime. But how about multitasking within the same terminal? Yeah this is possible(I bet almost everyone out there knows this, but consider this for the newbies).

The following command creates a .iso image of the CD in your drive, in the working directory
# dd if=/dev/cdrom of=image.iso

Now, once you’ve executed this, you’ll probably have to wait a long time to get a command prompt since creating an image ile can be time consuming.

Now consider this
# dd if=/dev/cdrom of=image.iso &

This command performs the same job, but in the background, which means you get your command prompt soon after you hit the Return key.

#jobs
this will probably list something like
[1] dd if=/dev/cdrom of=image.iso running

Now, to get this job into the foreground, type
# fg %1

Want to get this job back into the background?
#^z (Ctrl+z)
#jobs
#bg %job-number

That’s it!! Now have fun!!

Advertisements
Tagged ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: