How To Install xdg-user-dirs on Ubuntu 18.04

In this tutorial we learn how to install xdg-user-dirs on Ubuntu 18.04. xdg-user-dirs is tool to manage well known user directories

Introduction

In this tutorial we learn how to install xdg-user-dirs on Ubuntu 18.04.

What is xdg-user-dirs

xdg-user-dirs is:

xdg-user-dirs is a tool to help manage “well known” user directories like the desktop folder and the music folder. It also handles localization (i.e. translation) of the filenames.

The way it works is that xdg-user-dirs-update is run very early in the login phase. This program reads a configuration file, and a set of default directories. It then creates localized versions of these directories in the users home directory and sets up a config file in $(XDG_CONFIG_HOME)/user-dirs.dirs (XDG_CONFIG_HOME defaults to ~/.config) that applications can read to find these directories.

There are three methods to install xdg-user-dirs on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install xdg-user-dirs Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install xdg-user-dirs using apt-get by running the following command:

sudo apt-get -y install xdg-user-dirs

Install xdg-user-dirs Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install xdg-user-dirs using apt by running the following command:

sudo apt -y install xdg-user-dirs

Install xdg-user-dirs Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install xdg-user-dirs using aptitude by running the following command:

sudo aptitude -y install xdg-user-dirs

How To Uninstall xdg-user-dirs on Ubuntu 18.04

To uninstall only the xdg-user-dirs package we can use the following command:

sudo apt-get remove xdg-user-dirs

Uninstall xdg-user-dirs And Its Dependencies

To uninstall xdg-user-dirs and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove xdg-user-dirs

Remove xdg-user-dirs Configurations and Data

To remove xdg-user-dirs configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge xdg-user-dirs

Remove xdg-user-dirs configuration, data, and all of its dependencies

We can use the following command to remove xdg-user-dirs configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge xdg-user-dirs

References

Summary

In this tutorial we learn how to install xdg-user-dirs package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.