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.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
According to Linux 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.
Method 2
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.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0