Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Last active May 7, 2023 09:48
Show Gist options
  • Save tamakiii/fe813cf4375fe2f548b0e68e025e21de to your computer and use it in GitHub Desktop.
Save tamakiii/fe813cf4375fe2f548b0e68e025e21de to your computer and use it in GitHub Desktop.
Linux Application Directory Structure

In a Linux server environment, it's best to follow the Filesystem Hierarchy Standard (FHS) for organizing files and directories. Based on the FHS, here are some common locations to consider for your application:

  1. /opt: If your application is a standalone package that doesn't interfere with the rest of the system, you can place it in /opt. This is the common place for optional or third-party software. In this case, you would put your application into /opt/{my-name}/{application-name}.

  2. /usr/local: If your application is system-wide and can be shared among multiple users, you can place it in /usr/local. This location is generally used for software that is not managed by the system's package manager. In this case, your application would go into /usr/local/{my-name}/{application-name}.

  3. /home/{user}/: If your application is intended to be used only by a specific user, you can place it in their home directory. In this case, you would put your application into /home/{user}/{my-name}/{application-name}.

  4. /var/{my-name}: If your application generates variable data files (e.g., logs, caches, etc.), you can create a directory for your application under /var. In this case, your application would go into /var/{my-name}/{application-name}.

Choose the location based on your application's needs and system requirements. Remember to set the appropriate permissions and ownership for the directory and its files, so it can be accessed and executed properly by the intended users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment