Ubuntu 22.04 Tutorials

How to Install OneDrive on Ubuntu 22.04: step-by-step guide

Learn how to easily install OneDrive on Ubuntu 22.04 and access your files from anywhere. Follow our step-by-step guide for seamless cloud storage integration.


Ubuntu 22.04 is a popular Linux distribution known for its stability and user-friendly interface. If you are an Ubuntu user and want to access your files on Microsoft’s OneDrive cloud storage, you’ll be pleased to know that there is a straightforward method to install OneDrive using the sudo apt-get install onedrive command. In this article, we will guide you through the process of installing OneDrive on Ubuntu 22.04, enabling you to seamlessly sync and manage your files with the cloud.

Ubuntu 22.04


Before we begin, let’s ensure that you have the following prerequisites:

  • Ubuntu 22.04 installed on your system.
  • A stable internet connection.

Step 1: Update System Packages

Before installing any software, it’s always a good practice to update your system packages. Open the terminal and run the following command:

sudo apt-get update

This command will update the package lists and ensure that you have the latest versions of the software.

Step 2: Installing OneDrive

Once your system is up to date, you can proceed with installing OneDrive. In the terminal, run the following command:

sudo apt-get install onedrive

This command will fetch the OneDrive package from the Ubuntu repositories and install it on your system.

Step 3: Configuring OneDrive

After the installation is complete, you need to configure OneDrive to connect it to your Microsoft account. In the terminal, type the following command:


This will start the OneDrive configuration wizard. Follow the on-screen instructions, click on the link provided in the console and sign in with your Microsoft account. Afterwards copy the URL and paste it into the console to fulfill the “response uri” request. This will grant necessary permissions to sync your files.

Step 4: Syncing Files with OneDrive

With OneDrive installed and configured, you can start syncing your files. OneDrive creates a directory in your home folder where you can place the files you want to sync. Simply copy or move the files to the OneDrive directory, and they will automatically sync with the cloud.

To start the synchronization process, run:

onedrive --synchronize

Set Up Automatic Synchronization (Optional):

  • You can configure the OneDrive client to synchronize your files automatically. To do this, you can use the systemd service. Enable and start the OneDrive service with:
systemctl --user enable onedrive
systemctl --user start onedrive

This will start the OneDrive client automatically when you log in.

Step 5: Managing OneDrive

You’re all set! You now have OneDrive installed on your Ubuntu 22.04 system. Here are some common tasks related to managing your OneDrive files:

  • Monitoring Sync Status: You can monitor the sync status by running the command onedrive --monitor in the terminal. It will display the sync progress and any errors, if present.
  • Updating OneDrive: To update OneDrive to the latest version available in the Ubuntu repositories, use the command sudo apt-get update && sudo apt-get upgrade onedrive.


Here are some frequently asked questions about installing OneDrive on Ubuntu 22.04:

Can I install OneDrive using the “sudo apt-get install onedrive” command?

Yes, the sudo apt-get install onedrive command is a convenient way to install OneDrive on Ubuntu 22.04. It fetches the package from the Ubuntu repositories and installs it on your system.

How do I configure OneDrive after installation?

After installing OneDrive, run the command onedrive in the terminal to start the configuration wizard. Follow the instructions to sign in with your Microsoft account and set up the sync options.

Where can I find the OneDrive directory on my Ubuntu system?

The OneDrive directory is located in your home folder. You can access it by navigating to /home/your_username/OneDrive/ in the file manager.

Can I sync multiple OneDrive accounts on Ubuntu 22.04?

Yes, you can sync multiple OneDrive accounts by configuring each account separately using the onedrive command and specifying different sync directories.

How do I update OneDrive to the latest version?

To update OneDrive, use the command sudo apt-get update && sudo apt-get upgrade onedrive in the terminal. It will update the OneDrive package to the latest version available in the Ubuntu repositories.


Installing OneDrive on Ubuntu 22.04 is a straightforward process. By following the steps outlined in this guide, you can easily install and configure OneDrive on your Ubuntu system, allowing you to sync and access your files seamlessly. Enjoy the convenience of cloud storage with OneDrive on Ubuntu 22.04!

I hope this article was helpful! You can find more here: Ubuntu Tutorial Articles

author avatar
Patrick Domingues


  1. I have installed the onedrive folder, but can’t get a GUI up so I can open onedrive. Do you have any help with that?
    Kind regards, Carsten

  2. hi Patrick, I have installed onedrive for 1 onedrive account and now I want to add 2 more. How can I do that?

      1. Hi Patrick,
        When I enter “onedrive” I get the following response: “–synchronize or –monitor switches missing from your command line input. Please add one (not both) of these switches to your command line or use ‘onedrive –help’ for further assistance.

        No OneDrive sync will be performed without one of these two arguments being present.”

        1. 1. Initial Setup for the First Account:
          If you haven’t already set up OneDrive, you’ll need to configure it for the first account. Run onedrive –synchronize to set up and sync your primary OneDrive account.

          2. Configure a Second OneDrive Account:
          You need to create a separate configuration for the second account. This involves setting up a new directory for the configuration files and a separate sync folder.

          3. Steps for Setting Up Additional Account:
          – Create a new directory for the second account’s configuration, for example: mkdir ~/.config/onedrive-second
          – Set the XDG_CONFIG_HOME environment variable to point to this new directory when running the OneDrive client. This tells the client to use a different configuration directory.
          – Run the OneDrive setup with this variable. For example: XDG_CONFIG_HOME=~/.config/onedrive-second onedrive –synchronize
          – This will prompt you to go through the setup process for the second account, including logging in and giving permissions.

          4. Running Sync for Each Account:
          – To sync the first account, just run onedrive –synchronize.
          – To sync the second account, use the command with the modified environment variable: XDG_CONFIG_HOME=~/.config/onedrive-second onedrive –synchronize.

          5. Automation:
          You can automate this process by creating scripts or cron jobs that run these commands at regular intervals.

          6. Repeat for Additional Accounts:
          If you have more than two accounts, repeat these steps for each, ensuring each has its own configuration and sync directory.

  3. Does this OneDrive utility support selective sync like its Windows counterpart? If not it’d be a space hogger for me.

Leave a Comment

Stay Informed

Receive instant notifications when new content is released.