How can I use OneDrive in Ubuntu?

There is no official OneDrive program for Ubuntu. If you still synchronize your files and folders with OneDrive, we’ll show you here.

Set up OneDrive in Ubuntu – via terminal

1st step:

Photo: GIGA

Open a terminal by using the keyboard shortcut [Strg] + [Alt] + [T] presses. There type in the following command:

sudo apt install onedrive

Start the photo gallery(5 pictures)

Install Ubuntu in Virtualbox – that’s how it works

Confirmed with [Enter] and enter your password as confirmation. We downloaded around 92 MB for the installation.

2nd step:

Photo: GIGA
Photo: GIGA

Enter the command in the terminal to set up the OneDrive synchronization:

onedrive

The terminal will now display a URL. Click on the link to open it in the browser. If that doesn’t work, click the link with the right mouse button and choose “Open reference” out.

3rd step:

Photo: GIGA
Photo: GIGA

Sign in to your browser with your Microsoft account. Then you will see the message “Allow this app to access your information?“. Agrees with “And“If you agree.

4th step:

Photo: GIGA
Photo: GIGA

Your browser now shows an empty website. Click with the right click on the corresponding URL in the address bar and select “Copy” out.

5th step:

Photo: GIGA
Photo: GIGA

Switches back to the terminal and presses the key combination [Strg] + [Umschalt] + [V]to paste the url there. Confirmed with [Enter].

6th step:

Photo: GIGA
Photo: GIGA

Ubuntu monitors file changes in your OneDrive folder with the “inotify” service. However, this is deactivated by default. Activate it in the terminal with the commands:

  • systemctl --user enable onedrive
  • systemctl --user start onedrive

By default, all OneDrive files are in the Linux directory ~/OneDrive synchronized. You can see it when you open your “personal folder”.

Synchronize certain files / directories

Creates the configuration file ~/.config/onedrive/config. After you have edited it, it should look like this:

Verzeichnis1
Verzeichnis2/Unterverzeichnis1

Exclude certain files / directories from synchronization

Creates the configuration file ~/.config/onedrive/config. Inserts the following content:

# Directory where the files will be synced
sync_dir = "~/OneDrive"
# Skip files and directories that match this pattern
skip_file = ".*|~*"

There the line skip_file must be adjusted accordingly

skip_file = ".*|~*|auto*"

In our example, all files are excluded that start with a dot, (.), A tilde (~) or with auto start. A distinction is made between upper and lower case. You can also use the wildcards * (placeholders for any number of characters) and? Use (placeholder for a character).

Then apply the changes with the terminal command:

onedrive --resync

Those: ubuntuusers.de

Reference-www.giga.de