Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to put my work files (code) in /usr/local/src, but I think it's already a folder that has some other semantic meaning.

What is that? Should I put source code there, or is there a better place?

Edit - I am the sole user and admin of the machine, and I don't want to use my home directory because it's on an NFS drive.

share|improve this question
up vote 19 down vote accepted

According to FHS, /usr is the location where Distribution-based items are placed and /usr/local is the location where you'd place your own localized changes (/usr/local will be empty after a base install). So, for example, if you wanted to recompile an Ubuntu package from source, their package manager would place the source for package in /usr/src/{package dir}. If you downloaded a program not managed by your distribution and wanted to compile/install it, FHS dictates that you do that in /usr/local/src.

EDIT: Short answer, yes, put your code in /usr/local/src.

share|improve this answer
+1 for the short version :) – ripper234 Apr 7 '11 at 13:29

It depends on what you're doing with that source. If it's for reference, yes, that's a good place. /usr/local is reserved for software installed locally by the sysadmin. So, if you want to install software along with source files (for other programs to use or for people to look at), that's good.

It's not meant, however, to be a workspace. Since it is local, you can do whatever you want, of course, but this isn't designed to be the place to put your software development tree.

That should, really, be in a code repository (possibly in /srv/sourcerepo or something), and then developers would check out their own working copies into their home directories.

share|improve this answer
I second what mattdm says above. I usually use /usr/local/src as a good place for downloading third party source code (eg for patching and rebuilding packages), not my own source code, which as matt says, should be under /srv/... (though I usually use /srv/vcs/sourcerepo). And mirrored remotely, of course. – Faheem Mitha Apr 7 '11 at 18:44
@Faheem - my home directory is on an NFS drive, so I definitely don't work my source branch to be there (too slow). – ripper234 Apr 7 '11 at 18:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.