To create the standard directories such as Downloads, Documents, Desktop, etc., in a user’s home directory on Arch Linux, you can use the xdg-user-dirs-update command. This command creates the default directories specified by the XDG Base Directory specification.

Here are the steps to create these directories:

  1. Install xdg-user-dirs package:

    First, you need to ensure that the xdg-user-dirs package is installed. This package contains the necessary tools to manage user directories according to the XDG Base Directory specification.

    sudo pacman -S xdg-user-dirs
    
  2. Update user directories:

    Once the package is installed, you can run the xdg-user-dirs-update command to create the default directories in your home directory. This command will create directories such as Desktop, Documents, Downloads, Music, Pictures, Public, Templates, and Videos.

    xdg-user-dirs-update
    

    This command reads the configuration file at ~/.config/user-dirs.dirs and creates the specified directories.

  3. Verify the directories:

    After running the command, you can check your home directory to see if the directories have been created.

    ls ~/
    

Example

Here is an example step-by-step process:

  1. Install xdg-user-dirs:

    sudo pacman -S xdg-user-dirs
    
  2. Update user directories for the current user:

    xdg-user-dirs-update
    
  3. Verify the directories:

    ls ~/
    

You should see the standard directories (Desktop, Documents, Downloads, Music, Pictures, Public, Templates, Videos) created in your home directory.

Automating for New Users

To ensure that new users have these directories created automatically, you can add the xdg-user-dirs-update command to their login scripts. For example, you can add it to the global profile script:

  1. Edit the global profile script:

    sudo nano /etc/profile
    
  2. Add the following line at the end of the file:

    xdg-user-dirs-update
    

This will ensure that the xdg-user-dirs-update command is run whenever a user logs in, creating the necessary directories if they do not already exist.