amazon media file explorer download upload index folder image licenses menu widget Play Pause profile-settings more dots-two-horizontal dots-two-vertical more-vertical pending google-plus hangouts facebook instagram whatsapp spotify telegram twitter vine renren rss youtube twitch vimeo flickr dribble behance deviantart 500px steam github soundcloud skype reddit linkedin lastfm delicious stackoverflow pinterest xing flattr foursquare yelp World

Managing Jobs In Ubuntu (Minimize Processes)

One of the most frustrating experience when working on the shell or terminal is the limited control you have when a task is undergoing processes or running, for example, if you try installing a package, say mysql-server with the apt install command, we would watch how apt does its thing without the ability to do other stuff while that process is going on.

If you are used to windows OS, it can even be more annoying as we are used to multitasking. Of course, you can open a new terminal or shell and multi-task away, but it gets crazy when you have 5 terminal opened at a time, what if we can sort of background the process, or in other words, minimize the ongoing process and continue with other stuff.

In this guide, you will learn how to minimize processes, and work on other stuff while the process is still going on, this is similar to the way you would minimize a program on Windows or macOS, let's get started...

The scenario of what we would do are:

  • Open a new file in a text editor
  • Write a dummy or random words in the opened file
  • Background the text-editor, think of minimizing Microsoft Word
  • Confirm if the process is still running (the text editor)
  • Open up Text editor 2, write random words, background it
  • Bring up the first text editor, and save the file you are editing, background it and
  • Bring back the second text editor, save the file you are editing.

Create a new file using the nano editor in your home directory, for example:

 nano ~/note-1

The ~/ would reference the user home directory, for example, if the current user home folder is James, it would create the file in /home/james/note-1

With the note-1 file opened, write any random text, I will be writing: This is my first note book

Alright, press Ctrl + Z on your keyboard to minimize the note-1 file.

You can see you were immediately taken away from the editor, and taken to the shell to do other stuff. If you've done everything right, you should see an output similar to below:

[1]+ Stopped nano ~/note-1

The [1] is the job number of our process, Stopped is its status (more on this below), and lastly, it shows you are working on a file name note-1 in the home directory.

The stopped status means the process has been temporarily put into the background and is no longer attached to the current terminal (cannot produce output and is not receiving input from the user), but it is still using the system memory.

The TLDR version is stopped means the process is running in the background.

To confirm if the process is still running, run the following command:

ps au | grep nano

The above command is basically saying, look for a process named nano if running, and pipe the output into grep, the output is as follows:

user 5594 0.0 0.2 22280 4152 pts/0 T 21:31 0:00 nano /home/user/note-1

The PID of the above nano process is 5594, this would be different from yours.

Learn More on Displaying Running Processes In Ubuntu

As the process is minimized, you can go ahead and do other stuff, let's create an additional file.

 nano ~/note-2

With the note-2 file opened, write any random text, I will be writing: This is my second note book

Background it using Ctrl + Z

At this point, we haven't saved any of the files opened, which would get lost if we log out of the system. Let's save the first file in the text-editor, bring it up using the fg command.


It didn't bring up the first text editor, it instead brought up the most recent opened process (which is the opened note-2 file in the nano editor), background it and execute the jobs command, and you should see the following output:

[1]- Stopped nano ~/note-1
[2]+ Stopped nano ~/note-2

The output shows that I have two nano sessions in use, one modifying the note-1 file, and the other modifying note-2 file.

To bring up the first nano session, you simply run the fg command followed by the Job ID:

fg 1

Save the file you are editing using Ctrl + x and Y to confirm the changes.

If you re-run the jobs command you would see it only has one process left in the background, just type fg to bring it and up and save.

You can see how handy it is to background processes, you don't even have to use Ctrl + Z to background a process, you can background a process right when you execute it by entering a command with the ampersand symbol (&), for example, to open up a new a file in nano and background it immediately, use the following command:

nano ~/nano-3 &

This would open up a new file and background it immediately.

Note: Not all applications support background, in this case, you either use a multiplexer or even running a new instance of the terminal or shell.

Related Post(s)

  • How To Access Windows 10 Drive/Folder in VirtualBox

    To access Windows drive or folder in your Guest OS, you first of all, install VirtualBox guest utilities: sudo apt-get install virtualbox-guest-utils You then Add a shared folder by going into: Setti

  • Send Mail with Attachment Using Mutt in GNU/Linux

    Mutt is a powerful text-based mail client for Unix/Linux operating systems. It features color support, message threading, MIME support...

  • Using Pageant To Automatically Authenticate SSH key in Putty

    I can't count how many times I have typed my ssh key passphrase whenever my ssh connection times out, it is so annoying and repetitive. Well, thanks to the putty pageant, you can do that seamlessly.

  • Installing WP-CLI In a GNU/Linux Server

    WP-CLI is a command-line interface for WordPress. It can also be used with ClassicPress, as they are no differences in their usage, maybe just minimal if you are updating or downloading new ClassicPr

  • How To Send Mail To Multiple Addresses Using (mailx)

    In this guide, you'll learn a couple of ways you can send mail to multiple addresses using mailx. mailx is a utility program for sending and receiving mail. I assume you already have mailx command, i

  • Mounting and Unmounting Cloud Storage With (Rclone) in GNU/Linux

    Ever wondered if you could mount your preferred cloud storage as a virtual drive on your system? Thanks to Rclone, you can mount and access different kinds of cloud storage from a file manager, I'll