Correct default Linux directories

Thank you for reading this.

I've been using Arduino on and off since 2009 and have always installed the IDE from the repositories of whatever Linux distribution that I was using at the time. More recently I've noticed that the binaries are for an older Arduino version that, among other things, does not allow the scrolling of long lists of sketches or examples. Installing from Arduino's home page fixes that problem and adds some extra new features.

What is the correct location for the sketch and libraries directories?

Currently I have two arduino directories:

/home/phil/arduino-1.8.4/libraries

and:

/home/phil/arduino/sketchbook/libraries

Originally I had /home/phil/sketchbook/libraries, which I think is the correct default location but I could be wrong.

The "arduino" directory came about while installing support for the ESP-32 board and the "arduino-1.8.4" directory was created by installing the downloaded version of arduino-1.8.4 (I know there's a newer version).

Thank you for your advice.

The correct location for the user's libraries is the libraries subfolder of the sketchbook folder. The sketchbook folder location is set in the Arduino IDE at File > Preferences > Sketchbook location.

The Arduino IDE installation also contains a libraries folder, which is for the bundled libraries. There is also a hardware specific libraries folder in each hardware package. You should never put any of your own files in either of those libraries folders because they would be lost when you updated to a new version.

Thank you pert.

So, my original location /home/phil/sketchbook/libraries is correct as I though.

I had become confused, and not just because of old age, after reading a post on another forum to do with adding support for ESP boards.

Glad to help. FYI, /home/phil/sketchbook/hardware is the correct place to manually add hardware packages (packaged installed via Boards Manager are located in a different folder). Sometimes you will find advice to install hardware packages in the Arduino IDE installation folder but that's a bad idea for the same reason as installing libraries to that folder. Put them in the hardware subfolder of your sketchbook so they will persist through IDE updates.

Out of curiosity, is /home/phil/sketchbook/hardware Linux specific? Looking at a default Windows setup, there is no hardware directory in C:\Users\sterretje\Documents\Arduino.

Unlike the libraries folder, the Arduino IDE doesn't create that folder automatically. You have to manually create it the first time you manually install a hardware package but the IDE does look in that folder for hardware packages no matter which OS you're using.