I have some sources I want to compile using make. The sources will be compiled into a driver I'm going to use. What is the correct place for such files? /usr/share? /opt? /usr/local/...?

Edit: the driver is going to be a kernel driver, and I'll be using dkms for the installation. The distro I'll be using is Ubuntu, but I'll might also use it for other distros in the future

  • 2
    You should precise your OS (Linux ?), the type of driver (kernel module, CUPS driver, X11 driver, other…). Depending of the answer, we could give you a complete and accurate answer. Ideally you could point us the site which proposes the driver (you shouldn’t try to install things manually). In some cases, the installation is automated with a documented instruction. On Linux, you could have a directory per kernel version like /lib/modules/4.14.79-xxxx-std-ipv6-6 Oct 31, 2021 at 22:09
  • 2
    Also, for sources (not the compiled driver), /usr/src is a casual place, but is not mandatory. Oct 31, 2021 at 22:16
  • You'd develop the package in your home directory, then when it is installed, DKMS will unpack it to /usr/src. Nov 1, 2021 at 10:01

1 Answer 1


It's really up to you but normally sources are stored in /usr/src as mentioned in the comments. Since system-wide installed applications could install their sources in this directory as well, to avoid possible conflicts, you could use /usr/local/src instead but again in the end no one stops you from storing sources anywhere you want as long as you remember where they are and there are no conflicts. You may as well create /src - easy to find, easy to cd to.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .