4 ms·
FHS and distros that follow it aren't perfect, but it does make a big difference. I prefer Fedora-based and Arch-based flavors for that reason. It's usually p
by freedomben 6y ago
FHS and distros that follow it aren't perfect, but it does make a big difference. I prefer Fedora-based and Arch-based flavors for that reason. It's usually pretty easy to find stuff.
Backtrack used to do something like this and while it was easier compared to a lot of other debian/ubuntu based things, I still ran into some pain points.
A great command to keep handy is
ls -la `which <program>`
That will usually find you the binary right away, and if it's a symlink or something you'll see it in the ls output. It's especially useful to me because (generally speaking) I put stuff I build myself in ~/bin rather than `/usr/local/bin` so I can quickly tell if I'm using my own build or the package manager's.
Edit: FHS == Filesystem Hierarchy Standard - https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
- LMYahooTFY 6y agoThank you, that's informative and you and GP have made me feel better about this particular aspect of learning Linux.
- freedomben 6y agoMy pleasure! It can feel brutal at first to learn Linux, especially with so much choice out there (aka fragmentation?), but honestly it's the best thing I ever did for myself both personal and career-wise. Can't recommend at least basic Linux proficiency enough if you are in a technology sector especially.
- forgotpwd16 6y agoInterestingly Arch address multiple bin directories mess by symlinking /bin, /sbin, and /usr/sbin to /usr/bin. Stali, an experimental distro (originally a suckless.org project), goes that a bit further by symlinking /sbin to /bin and /usr to /.
- pkaye 6y agoIts the same in Ubuntu and Centos with symlinks of the bin directories.
- stonesweep 6y agoBig picture, this is known as "the usr merge" which has been happening for probably a decade, each distro is approaching it at their own speed as they're not all exactly identical in their FHS layout (some distros add a bit of this and that on top). You can read about it at a meta level over here, each distro has it's own wiki/working page if you Google around: https://www.freedesktop.org/wiki/Software/systemd/TheCaseForTheUsrMerge/ https://www.freedesktop.org/wiki/Software/systemd/TheCaseFor...
- voidfunc 6y agoThe FHS really only makes sense when you use Linux as traditionally intended as a multi-user system. Most uses of Linux are single-user, running as a server, or even more just a container.
- freedomben 6y agoI'm not sure I agree that most uses of Linux are single-user. I know this (likely) isn't what you meant, but at a minimum most every system, even containers, will have at least two users: root and the non-privileged user account. It may not be two humans but it is two users. On my current desktop (where I'm the only human user) I have 53 entries in /etc/passwd. Each have different permissions and access to resources. But even if you consider the above to be a single-user setup (which is reasonable) I still think there's value in consistency. I personally get a ton of value from having CentOS and RHEL systems being laid out the same as my Fedora Laptop and Desktop system, and having all that knowledge transfer both ways. Being able to add a user to a "single user" setup too is very useful. It would suck if adding a second user required completely changing everything about the filesystem.
- sergeykish 6y agoFHS makes sense from a system developer standpoint — entire system is a project /lib for libraries /usr/include for C includes /etc for configs
- stonesweep 6y agotrivia: `which` is not the same which on all distros - on Ubuntu for example it's a super simple shell script named `which` which supports one single param (-a), not the compiled binary that you have on say Arch - and the features are different between them - I can't for example run `which --skip-tilde which` on Ubuntu, invalid usage. Many scripters who need wide compatibility of "which" fall back to the builtins `type` and `command` as they resolve any bash aliases set and give you a more truthful (sic) output than relying on `which` and bash is bash on all platforms: # command -v which /usr/bin/which # type which which is hashed (/usr/bin/which) $0.02 for your next adventure down the `which` rabbit hole. :)
- akira2501 6y agoIt can also be a shell builtin: akira@akira:~ which which which: shell built-in command
- stonesweep 6y agoVery true, I missed that thanks - to illustrate how that could be important (to the scripter): kaneda@tetsuo:~ which type kaneda@tetsuo:~ type type type is a shell builtin kaneda@tetsuo:~ command -v type type This was on Ubuntu, the which script doesn't resolve type or command silently, while on say Arch it's verbose ("can't find type in (paths ... ...)" so even a failure-to-find emits differently for the `which` crowd.
- turminal 6y ago> Many scripters who need wide compatibility of "which" fall back to the builtins `type` and `command` as they resolve any bash aliases set When wide compatibility is needed it is best to avoid bash specific solutions.
- account42 6y ago`command -v` is standard POSIX sh [0] [0] https://pubs.opengroup.org/onlinepubs/9699919799/utilities/command.html https://pubs.opengroup.org/onlinepubs/9699919799/utilities/c...
- Fnoord 6y ago> I prefer Fedora-based and Arch-based flavors for that reason. It's usually pretty easy to find stuff. > Backtrack used to do something like this and while it was easier compared to a lot of other debian/ubuntu based things, I still ran into some pain points. FTA you linked: > Most Linux distributions follow the Filesystem Hierarchy Standard and declare it their own policy to maintain FHS compliance. GoboLinux and NixOS provide examples of intentionally non-compliant filesystem implementations. Debian and Ubuntu adhere to FHS; they're not more difficult in this regard than Arch or Fedora (or distributions based on these). GoboLinux and NixOS don't because they serve a higher goal. GoboLinux for user-friendliness/explorability and has backwards compatibility (which is hidden via optional kernel extension), NixOS aims to solve dependency hell (among various other goals). Learning curves are an obvious drawback. > ls -la `which <program>` Backticks should be avoided; use ls -la $(which <program>) instead (avoid the $ in Fish).