If you’re a Gmail user on Ubuntu PC, there are a few things you can do to help protect your account from potential data loss. First, create a new Gmail account and password if you don’t have one already. Next, back up your email and calendar data to an external storage device like USB drive or hard drive. Finally, make sure that your Google account is enabled for two-factor authentication so that if someone tries to access your account without providing two-factor authentication code, they’ll be blocked.


We always hear how important it is to backup your data, but do we think about backing up our web-based email? We have shown you how to backup your Gmail account using programs in Windows, but what if you are using Linux?

In Windows, you can use GMVault or Thunderbird to backup your Gmail account. You can use Thunderbird in Linux as well, but there iss also a program for Linux called Getmail that will backup your Gmail account to a single mbox file. Getmail works in any Linux distribution. Ubuntu users can easily install Getmail using the Ubuntu Software Center. For other Linux operating systems, download Getmail, and then refer to the installation instructions on the website.

We will show you how to install and use Getmail in Ubuntu. Open the Ubuntu Software Center using the icon on the Unity bar.

Type “getmail” (without the quotes) in the Search box. The results display as you enter the search term. Select the “Mail retriever” result and click Install.

On the Authenticate dialog box, enter your password and click Authenticate.

Once the installation finishes, exit the Ubuntu Software Center by selecting Close from the File menu. You can also click the X button on the title bar.

Before using Getmail, you need to create a configuration directory, a directory to store the mbox file, and the mbox file itself. To do this, open a Terminal window by pressing Ctrl + Alt + T. At the prompt, type the following command to create the default configuration directory.

To create a directory for the mbox file that will be filled with your Gmail messages, type the following command. We called our directory “gmail-archive” but you can call the directory what you want.

Now, you must create the mbox file to contain the downloaded messages. Getmail does not do this automatically. Type the following command at the prompt to create the mbox file in the gmail-archive directory.

NOTE: Both “$HOME” and “~” refer to your home directory at /home/.

Leave this Terminal window open. You will use it later to run Getmail.

Now, you need to create the configuration file to tell Getmail about your Gmail account. Open a text editor, such as gedit, and copy the following text into a file.

Change the username and password to the ones for your Gmail account. If you used a different directory and filename for the mbox file, change the “path” in the “destination” section to reflect your path and filename.

Select Save As to save your configuration file.

Enter “.getmail/getmailrc” (without the quotes) in the Name edit box to save the file as the default “getmailrc” file in the configuration directory you created and click Save.

Close gedit, or whatever text editor you used.

To run Getmail, go back to the Terminal window and type “getmail” (without the quotes) at the prompt.

You’ll see a long string of messages display in the Terminal window as Getmail starts downloading the contents of your Gmail account.

When Getmail finishes and you are returned to the prompt, you can close the Terminal window by typing exit at the prompt, selecting Close Window from the File menu, or clicking the X button on the title bar.

You now have an mbox file containing your Gmail messages.

You can import the mbox file into most email clients, except Microsoft Outlook. For example, you can use the ImportExportTools add-on in Thunderbird to import your Gmail messages from your mbox file into a local folder.

If you need to get your Gmail messages into Outlook in Windows, you can use the free MBox Email Extractor program to convert your mbox file to separate .eml files that you can import into Outlook.

You can automate the process of backing up your Gmail account by creating a shell script and setting it to run on a schedule using a cron job that runs once a day, once a week, or however often you feel is necessary.

For more information about using Getmail, see their documentation.