Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
652
votes
8
answers
490743
views
What is the difference between /opt and /usr/local?
According to the [Filesystem Hierarchy Standard](https://www.pathname.com/fhs/pub/fhs-2.3.html), `/opt` is for "the installation of add-on application software packages". `/usr/local` is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Soft...
According to the [Filesystem Hierarchy Standard](https://www.pathname.com/fhs/pub/fhs-2.3.html) ,
/opt
is for "the installation of add-on application software packages". /usr/local
is "for use by the system administrator when installing software locally". These use cases seem pretty similar. Software not included with distributions usually is configured by default to install in either /usr/local
or /opt
with no particular rhyme or reason as to which they chose.
Is there some difference I'm missing, or do both do the same thing, but exist for historical reasons?
Patches
(6862 rep)
Apr 18, 2011, 08:08 AM
• Last activity: May 3, 2025, 07:10 AM
-1
votes
1
answers
36
views
package installation directories
When you automatically download and install packages through the apt or dpkg command , it installed in in a very detailed instructions(i mean perfectly in usr/share and usr/lib); i wanted to know : 1 . how the developers choose the directories and not simply put all of them in a folder;i know it's r...
When you automatically download and install packages through the apt or dpkg command , it installed in in a very detailed instructions(i mean perfectly in usr/share and usr/lib);
i wanted to know :
1 . how the developers choose the directories and not simply put all of them in a folder;i know it's related to FHS but if you look at the picture below you see they have made a lot of symbolic links to another directories like you have symbolic links in usr/share/firefox-esr for usr/lib/firefox-esr and vice versa;
you see symbolic link points to somewhere else , or sometimes points to usr/share (though we could just put the file in the usr/lib);
i know it's FHS but no where has any instruction to guide me to this level of complexity;
if there is any instruction written somewhere or any book , would be happy to know the link.

Ramin
(1 rep)
Mar 18, 2025, 01:12 PM
• Last activity: Mar 18, 2025, 01:40 PM
0
votes
1
answers
42
views
Where should I store my application data (i.e. json, images and some audio files)?
I have a top-bar setup that requires some additional files: 1. ```icons.json``` for icons used in that bar. 2. Some custom ```.png```s like google-```calendar.png```, ```user.png```. 3. Some ```.mp3``` files like ```notify.mp3``` for incoming notifications. Now the configuration file for this bar is...
I have a top-bar setup that requires some additional files:
1.
.json
for icons used in that bar.
2. Some custom .png
s like google-.png
, .png
.
3. Some .mp3
files like .mp3
for incoming notifications.
Now the configuration file for this bar is stored under ~/.config
and I want these additional files to be specific to the current user only too. A different user must set his bar up himself.
Another thing is some of these files won't change (i.e. -calendar.png
, .mp3
) and some will (i.e. .json
containing calendar events).
In that case what's the best way to store these files?
Abir Halder
(1 rep)
Nov 26, 2024, 05:35 PM
• Last activity: Nov 26, 2024, 07:25 PM
0
votes
1
answers
52
views
In the Filesystem Hierarchy Standard, what exactly is a "shareable file"?
The [3.0 Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf) mentions Linux hosts and the concept of a shareable file: > "Shareable" files are those that can be stored on one host and used on others. "Unshareable" files are those that are not shareable. For examp...
The [3.0 Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf) mentions Linux hosts and the concept of a shareable file:
> "Shareable" files are those that can be stored on one host and used on others. "Unshareable" files are those
that are not shareable. For example, the files in user home directories are shareable whereas device lock
files are not.
[...] Shareable files can be stored on one host and used on several others. Typically, however, not all
files in the filesystem hierarchy are shareable and so each system has local storage containing at
least its unshareable files. It is convenient if all the files a system requires that are stored on a
foreign host can be made available by mounting one or a few directories from the foreign host.
However, I can't understand exactly what it means. A "shareable file" is a file that can be shared across a local network of Linux machines (Linux hosts)? How the restriction of shareable/unshareable works in practice (for example, the OS will prevent an "unshareable" file from being "shared")?
wrongbyte
(101 rep)
Nov 20, 2024, 01:45 AM
• Last activity: Nov 20, 2024, 09:44 AM
-1
votes
1
answers
79
views
Where should non-root-user programs write the data which system-level programs write to (subdirectories of) /var?
### Background Unix convention and the Linux Filesystem Hierarchy standard define several paths under which processes look for certain information, or use to write certain information. When one needs to setup a user-specific environment, as a non-root user - most of those locations are either inacce...
### Background
Unix convention and the Linux Filesystem Hierarchy standard define several paths under which processes look for certain information, or use to write certain information. When one needs to setup a user-specific environment, as a non-root user - most of those locations are either inaccessible, or readable but without the ability to write to files or create new ones. So, one must use alternatives.
In principle, we could just treat a user's home directory like another
/
; however, that's not common practice.
There is also the custom of creating a $HOME/.my_app
directory. Most apps which create those use those for configuration, but some also for other kinds of data (Eclipse, Firefox, Thunderbird come to mind as hiding gobs of data in there). But that means we may have dozens if not hundreds of .something
in the home directory, which is quite unseemly.
Finally, it has also become common for some apps to write into $HOME/.local
and $HOME/.config
, which does not "litter" the home directory itself: $HOME/.config
can be seen as an equivalent of /etc
and $HOME.local
of /usr
; so, quite useful, but - it doesn't cover /var
and its subdirectories.
### Actual question
Where, under a user's home directory, should we, or should a program we write, store the data which a system-level program would store in /var
, or subdirectories of /var
? That is to say: "files whose content is expected to continually change during normal operation of the system, such as logs [and] spool... files" (to quote the FHS), as well as cache, non-static databases, lock files, run files and log files?
einpoklum
(10753 rep)
Nov 14, 2024, 04:47 PM
• Last activity: Nov 14, 2024, 10:28 PM
12
votes
1
answers
6514
views
What is the meaning/purpose of *.pid files in /var/run
I'm quite new in Linux world, and now I'm trying to understand [FHS][1] principles. In `/var/run` I found about ten `*.pid` files like `crond.pid` which contain just PIDs. There are more than ten processes running in the system and just ten files. So what is their purpose and what generated them? [1...
I'm quite new in Linux world, and now I'm trying to understand FHS principles.
In
/var/run
I found about ten *.pid
files like crond.pid
which contain just PIDs.
There are more than ten processes running in the system and just ten files.
So what is their purpose and what generated them?
Alex Silkovsky
(263 rep)
Sep 12, 2015, 09:32 PM
• Last activity: Nov 12, 2024, 08:46 PM
9
votes
3
answers
10005
views
Per user tmpfs directories
Using the shared `/tmp` directory is known to have lead to many security vulnerabilities when predictable filenames have been used. And randomly generated names aren't really nice looking. I am thinking that maybe it would be better to use a per user temporary directory instead. Many applications wi...
Using the shared
/tmp
directory is known to have lead to many security vulnerabilities when predictable filenames have been used. And randomly generated names aren't really nice looking.
I am thinking that maybe it would be better to use a per user temporary directory instead. Many applications will use the TMPDIR
environment variable in order to decide where temporary files goes.
On login I could simply set TMPDIR=/temp/$USER
where /temp
would then have to contain a directory for each user with that directory being writable to that user and nobody else.
But in that case I would still like /temp
to be a tmpfs
mountpoint, which means that the subdirectories would not exist after a reboot and need to be recreated somehow.
Is there any (de-facto) standard for how to create a tmpfs
with per user subdirectories? Or would I have to come up with my own non-standard tools to dynamically generate such directories?
kasperd
(3650 rep)
Mar 25, 2015, 12:18 PM
• Last activity: Nov 11, 2024, 07:45 PM
0
votes
1
answers
50
views
Where to store shareable application data for home user?
I'm working on a project that uses `ags` (with `gtk-layer-shell`) to provide a top bar similar to `waybar`. I'm also building a gui app with pyGtk that'll be used to change that bar's appearance and settings. Since I want this setup only to be available to the `$home` user I couldn't understand whic...
I'm working on a project that uses
ags
(with gtk-layer-shell
) to provide a top bar similar to waybar
. I'm also building a gui app with pyGtk that'll be used to change that bar's appearance and settings.
Since I want this setup only to be available to the $home
user I couldn't understand which directory should fit best. For example, if the bar uses a color scheme (css/json format) and I open my settings app it should first show me the current color scheme (means that data is shareable among the bar and the app) from where I can set a new one.
Other things include changing font size, bar position etc.
Currently I only have $home/.config/ags
where I store the actual ags
setup excluding any color scheme or default icons data.
Abir Halder
(1 rep)
Aug 28, 2024, 04:12 PM
• Last activity: Aug 28, 2024, 08:02 PM
1
votes
1
answers
78
views
FHS: what is "the map installer"?
In the Filesystem Hierarchy Standard 3.0 under the section *3.5.1 "The Root Filesystem - /boot : Static files of the boot loader - Purpose"*: >This directory contains everything required for the boot process except configuration files not needed at boot time and the map installer. What is this **map...
In the Filesystem Hierarchy Standard 3.0 under the section *3.5.1 "The Root Filesystem - /boot : Static files of the boot loader - Purpose"*:
>This directory contains everything required for the boot process except configuration files not needed at boot time and the map installer.
What is this **map installer**. I wasn't able to find anything myself, hence the question.
Here's the link to the document I'm referring to, just in case: https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf
Rostislav Frolov
(13 rep)
Aug 17, 2024, 03:48 PM
• Last activity: Aug 17, 2024, 08:15 PM
42
votes
6
answers
5405
views
What are the alternatives to the FHS?
I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that `/usr/bin` is the dumping ground for binaries or libs in `/usr/lib`, `/usr/lib32`, `/usr/libx32`, `/lib`, `/lib32` etc... Random stuff in `/usr/share` etc. It's dum...
I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that
/usr/bin
is the dumping ground for binaries or libs in /usr/lib
, /usr/lib32
, /usr/libx32
, /lib
, /lib32
etc... Random stuff in /usr/share
etc. It's dumb and confusing. But some like it and tastes differ.
I want a directory structure where each package is isolated. Imagine instead if the media player dragon had it's own structure:
/software/dragon
/software/dragon/bin/x86/dragon
/software/dragon/doc/README
/software/dragon/doc/copyright
/software/dragon/lib/x86/libdragon.so
Or:
/software/zlib/include/zlib.h
/software/zlib/lib/1.2.8/x86/libz.so
/software/zlib/lib/1.2.8/x64/libz.so
/software/zlib/doc/examples/...
/software/zlib/man/...
You get the point. What are my options? Is there any Linux distro that uses something like my scheme? Can some distro be modified to work like I want it (Gentoo??) or do I need LFS? Is there any prior art in this area? Like publications on if the scheme is feasible or unfeasible?
Not looking for OS X. :) But *OS X-inspired* is totally ok.
**Edit**: I have no idea how PATH
, LD_LIBRARY_PATH
and other environment variables that depend on a small set of paths should work out. I'm thinking that if I have the KDE editor Kate installed in /software/kate/bin/x86/bin/kate
then I'm ok with having to type the full path to the binary to start it. How it should work for dynamic libraries and dlopen
calls, I don't know but it can't be an unsolvable engineering problem.
Gaslight Deceive Subvert
(716 rep)
Sep 4, 2015, 06:48 PM
• Last activity: Aug 10, 2024, 01:49 PM
1
votes
1
answers
289
views
Where can I view all distros currently compliant with the Linux Filesystem Hierarchy Standard?
The [Linux Filesystem Hierarchy][1] Standard hasn't been updated [since 2015][2] (FHS 3.0). I'm assuming a lot has changed in the ecosystem since then, and because of this, certain distros may/may not be compliant with the standard anymore. I'm curious if there exists a list or some other store of i...
The Linux Filesystem Hierarchy Standard hasn't been updated since 2015 (FHS 3.0). I'm assuming a lot has changed in the ecosystem since then, and because of this, certain distros may/may not be compliant with the standard anymore.
I'm curious if there exists a list or some other store of information regarding the compliance status of various distros with the standard. Does anyone know?
noG23
(19 rep)
Dec 29, 2022, 01:35 AM
• Last activity: Aug 10, 2024, 01:38 PM
0
votes
1
answers
145
views
Why did Red Hat relocate Apache to /usr/sbin
I run Apache http servers on Red Hat and Oracle Linux machines. The account requires that only packages from the Red Hat or Oracle repositories be used. That’s fine , they work and are reasonably current. So a new SA joined and was shocked and amazed that the apachectl script and httpd image are bei...
I run Apache http servers on Red Hat and Oracle Linux machines. The account requires that only packages from the Red Hat or Oracle repositories be used. That’s fine , they work and are reasonably current. So a new SA joined and was shocked and amazed that the apachectl script and httpd image are being put into /usr/sbin, stating that in all the years they’ve been running Unix systems none ever were done like that and it’s a contravention of the Unix way.
Well I don’t really care one way or the other but maybe he has a point. Does anyone know why Red Hat chose this arrangement?
JakeS
(11 rep)
Apr 8, 2024, 10:04 PM
• Last activity: Apr 9, 2024, 07:24 AM
-1
votes
1
answers
99
views
Are any modifications to the FHS being worked on (by the Linux Foundation)?
https://unix.stackexchange.com/a/227625/386242 explains the myriad benefits of a simpler and more consistent filesystem hierarchy, but also that without any cross-OS standardization, such efforts are as much of a disadvantage as they are an advantage. Consequently, is the Linux Foundation drafting a...
https://unix.stackexchange.com/a/227625/386242 explains the myriad benefits of a simpler and more consistent filesystem hierarchy, but also that without any cross-OS standardization, such efforts are as much of a disadvantage as they are an advantage.
Consequently, is the Linux Foundation drafting a Filesystem Hierarchy Standard 3.1 or 4.0?
RokeJulianLockhart
(541 rep)
Mar 26, 2024, 10:48 PM
• Last activity: Mar 27, 2024, 06:18 AM
173
votes
4
answers
152438
views
Where should a local user executable be placed (under $HOME)?
I have an executable for the perforce version control client (`p4`). I can't place it in `/opt/local` because I don't have root privileges. Is there a standard location where it needs to be placed under `$HOME`? Does the File System Hierarchy have a convention that says that local executables/binari...
I have an executable for the perforce version control client (
p4
). I can't place it in /opt/local
because I don't have root privileges. Is there a standard location where it needs to be placed under $HOME
?
Does the File System Hierarchy have a convention that says that local executables/binaries need to be placed in $HOME/bin
?
I couldn't find such a convention mentioned on the [Wikipedia article for the FHS](http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard) .
Also, if there indeed is a convention, would I have to explicitly include the path to the $HOME/bin
directory or whatever the location of the bin
directory is?
user640378
(2023 rep)
Apr 19, 2012, 02:16 PM
• Last activity: Dec 29, 2023, 11:07 PM
5
votes
2
answers
3100
views
What is meant by "locally installed package" in the world of Unix?
I've been scratching my head over the File System Hierarchy Standard recently and in numerous occasion, when talking about the `/usr/local` directory, I came across the term "locally installed packages". Could someone please explain what is exactly meant by "local" in this context?
I've been scratching my head over the File System Hierarchy Standard recently and in numerous occasion, when talking about the
/usr/local
directory, I came across the term "locally installed packages". Could someone please explain what is exactly meant by "local" in this context?
Paghillect
(967 rep)
Oct 1, 2017, 12:13 AM
• Last activity: Oct 13, 2023, 11:54 AM
79
votes
4
answers
63373
views
What is the purpose of /usr/libexec?
Executables are stored in `/usr/libexec` on Unix-like systems. [The FHS says][1] (section `4.7. /usr/libexec : Binaries run by other programs (optional)"`: > `/usr/libexec` includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a sing...
Executables are stored in
/usr/libexec
on Unix-like systems. The FHS says (section 4.7. /usr/libexec : Binaries run by other programs (optional)"
:
> /usr/libexec
includes internal binaries that are not intended to be executed directly by users or shell scripts. Applications may use a single subdirectory under /usr/libexec
.
On macOS, rootless-init
a program called by launchd
immediately after booting, is stored in /usr/libexec
.
Why would it be stored in /usr/libexec
when it is a standalone executable that could be stored in /usr/bin
or /usr/sbin
? init
and other programs not called directly by shell scripts are also stored in folders like [/usr]/{bin,sbin}
.
Melab
(4328 rep)
Sep 24, 2016, 10:33 PM
• Last activity: Oct 8, 2023, 07:11 PM
1
votes
1
answers
544
views
will DNF [YUM] fail if /var/tmp is a tmpfs file system?
I was considering making `/var/tmp` a `tmpfs` mount, similar to *systemctl enable tmp.mount* in order to meet a security rule requesting `/var/tmp` be on a separate partition. I did not make that physical partition at linux install time. > The FHS (File hierarchy standard) states *The /var/tmp direc...
I was considering making
/var/tmp
a tmpfs
mount, similar to *systemctl enable tmp.mount* in order to meet a security rule requesting /var/tmp
be on a separate partition. I did not make that physical partition at linux install time.
> The FHS (File hierarchy standard) states *The /var/tmp directory is made available for programs that require temporary files or directories that are preserved between system reboots. Therefore, data stored in /var/tmp is more persistent than data in /tmp.*
Specifically, for RHEL 8.8 or later, can having /var/tmp
as a tmpfs
(where it will be cleared after every reboot), cause a **yum update** to fail? Is YUM [DNF] in RHEL 8 once of those *programs*? If so, under what conditions would some sort of failure occur with /var/tmp
as tmpfs? And if so, is there a manner in which to run yum/dnf that can allow it to work with a tmpfs /var/tmp
? I ask because I see various /var/tmp/yum-xxxx
folders from time to time.
reference posts:
https://unix.stackexchange.com/questions/757679/tmp-and-var-tmp-as-tmpfs-and-volatility
https://unix.stackexchange.com/questions/86297/what-can-go-wrong-if-var-tmp-is-on-a-temporary-filesystem
ron
(8647 rep)
Oct 2, 2023, 03:11 PM
• Last activity: Oct 2, 2023, 06:29 PM
0
votes
0
answers
1493
views
the relation of /opt /etc/opt and /var/opt
I am reading the Linux [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html), and I am wondering about the relation of [/opt][1], [/etc/opt][2] and [/var/opt][3]. I can read in 2 places that static configuration and variable data for an add-on installed under /op...
I am reading the Linux [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.html) , and I am wondering about the relation of /opt , /etc/opt and /var/opt .
I can read in 2 places that static configuration and variable data for an add-on installed under /opt, should go into /etc/opt and /var/opt:
> Package files that are variable (change in normal operation) must be installed in /var/opt. See the section on /var/opt for more information.
>
> Host-specific configuration files must be installed in /etc/opt. See the section on /etc
for more information.
>
> *ref: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html*
> Host-specific configuration files for add-on application software packages must be installed within the directory /etc/opt/, where is the name of the subtree in /opt where the static data from that package is stored.
>
> *ref: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s07.html#etcoptConfigurationFilesForOpt*
But there is also the below paragraph which leads to my confusion:
> Generally, all data required to support a package on a system must be present within /opt/, including files intended to be copied into /etc/opt/ and /var/opt/ as well as reserved directories in /opt.
>
> *ref: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html*
It appears that the result of these "rules" is that the config and runtime data should exist twice. And it should be copied from /opt to /{etc,var}/opt. That does not appear practical to me. How am I supposed to handle the conflicting sources of truth and file changes?
The Fool
(195 rep)
Aug 26, 2023, 10:24 AM
0
votes
1
answers
78
views
/usr/local subdirectories allowed?
I'm currently having some conflicted doubts about the `/usr/local` folder according to the standard. In our application, we currently store our read-only application files in `/usr/local/ `. While going through the [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04...
I'm currently having some conflicted doubts about the
/usr/local
folder according to the standard.
In our application, we currently store our read-only application files in /usr/local/
. While going through the [Filesystem Hierarchy Standard](https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s09.html) it noted that no other directories may be in /usr/local
other than those listed.
Another [user on Stack Overflow](https://stackoverflow.com/a/34166003/9398242) quoted a text specifying that /usr/local/
is supposed to be used, but I'm unable to find this part in the FHS.
Other examples I've seen on my machine are /usr/local/mysql
and /usr/local/percona
.
Are these simply not in line with the standard? Should we be switching to /usr/local/share/
?
Indra
(3 rep)
Jun 30, 2023, 10:08 AM
• Last activity: Jun 30, 2023, 10:34 AM
25
votes
1
answers
12186
views
Why is /bin a symbolic link to /usr/bin?
According to the [Filesystem Hierarchy Standard][1] the `/bin` directory should contain utilities needed in single user mode. In practice, many Linux distributions make the directory a symbolic link to `/usr/bin`. Similarly, `/sbin` is nowadays often a symbolic link to /`usr/bin` as well. What's the...
According to the Filesystem Hierarchy Standard the
/bin
directory should contain utilities needed in single user mode. In practice, many Linux distributions make the directory a symbolic link to /usr/bin
. Similarly, /sbin
is nowadays often a symbolic link to /usr/bin
as well.
What's the rationale behind the symlinks?
unhack
(905 rep)
Feb 29, 2016, 01:16 PM
• Last activity: Jun 1, 2023, 10:12 PM
Showing page 1 of 20 total questions