Filesystem Hierarchy Standard (FHS) and LSB

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Filesystem Hierarchy Standard (FHS) and LSB

Post by wiak »

viewtopic.php?p=3046#p3046
viewtopic.php?p=3060#p3060
cobaka wrote: Thu Aug 20, 2020 11:53 pmOn the topic of $PATH:
$PATH is a variable not a command.
echo is a command.
This is what I figure: When I type at the CLI (the command-line interpreter/the shell) I must precede the name of a variable by a command.
You are absolutely correct there. If you simply type $PATH you are running its content as if it is a command, which shows its content certainly, but also gets error message sent to standard error device (so generally appears on your display screen as part of the resultant output).

As far as standard, generally recommended locations for executables is concerned (and yes, scripts can be made executable via chmod +x path_to_scriptname) I would advise you look at the following. It is simple enough:

https://refspecs.linuxfoundation.org/FH ... index.html

or...

If you intend taking up Linux System Admin as a professional (or simply following their lead) then Red Hat is the major commercial Linux and Red Hat Enterprise Linux documentation the main source for the majority of professional Linux courses used by the majority of national tertiary education institutions, so RHEL manuals (despite being Red Hat focussed more generally) are a great resource for answering such questions. For example, you can go to RedHat site and try and find latest, but I preferred the way they previously presented their manual, so this one should do for your understanding:

https://web.mit.edu/rhel-doc/5/RHEL-5-m ... m-fhs.html

There is however really nothing to stop a system admin assigning other locations for executables and putting these other locations in the search PATH. That's what Puppy developer has done with /root/my-applications/bin. However, if systemd had been around and... Puppy had happened to adopt that (sigh) they could well have used $HOME/.local/bin (~/.local/bin/), which is actually quite a handy alternative anyway. It is detailed here:

https://www.freedesktop.org/software/sy ... archy.html

By the way, early UNIX only had binary commands, hence the bin name for where commands are stored. However, shell scripts include a hash bang header such as #!/bin/bash. When these shell scripts are made executable it is actually the binary /bin/bash that gets run and the shell script itself simply provides the lines to be interpreted:

https://unix.stackexchange.com/question ... n-that-way


Another reference document, programmers might find it useful to become familiar with is Linux Standard Base:

https://refspecs.linuxfoundation.org/lsb.shtml

For example for list of libraries that should be available on a Linux Standard Base system (including the names they should have):

https://refspecs.linuxfoundation.org/LS ... ments.html

and expected commands:

https://refspecs.linuxfoundation.org/LS ... mands.html

Whilst above could be said to be of interest mainly to programmers much of it is not overly technical for experienced Linux users and probably of some interest to many more generally.

wiak

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
cobaka
Posts: 520
Joined: Thu Jul 16, 2020 6:04 am
Location: Central Coast, NSW - au
Has thanked: 87 times
Been thanked: 49 times

Filesystem Hierarchy Standard (FHS) and LSB

Post by cobaka »

@wiak
others incl bigpup

That info you sent - esp the standard that specifies the use/function of the filesystem - was vy helpful.
(@bigpup Now I understand the legit use of the folder called my-applications. Yes, a small piece of info, but very useful.

Returning to standards and operating procedures:
I learned a great deal reading WWII military manuals. I began reading the manuals to learn about maintaining the equipment described. That was the purpose of the manual, but military manuals are so well written I finished reading them to understand how to set out a manual and even understand the military supply and assembly process. A type of reverse engineering, if you like.

I am a user of Puppy Linux - definitely not a developer. I use the shell because the various utilities (grep, awk, sed) allow me to perform valuable work quickly. Puppy Linux (and Linux generally) is very capable, very flexible. The plasticity of Linux and Puppy (in particular) is a asset and liability. I will comment only liability because the advantages are well known. In short - unless us Puppians develop and use well know and accepted standards of construction/layout/use the very plasticity that we adore has the potential to might bring the puppy to its knees.

(This topic of this thread has now changed! I am no longer writing about script-files and folders. I am writing about the value of standard operating procedures and so on and what happens when when 'da Puppy' is mis-used. I failed to understand the basic construction and operating philosophy. The result: I clobbered the pupsave file. Everything after this describes how that happened.)

Stupidity runs wild! For months I had been using uPupBB32. Joy of joys! Everything worked and worked fast on old hardware! I thought: time to create a back-up of the pupsave file. I booted puppy w/out the Pup-save file. I copied and re-named the pupsave file (pupsave-may11 or something like that). I 'hid' the 'save-may11' file somewhere. Then I shut-down puppy w/out creating a pup-save file. To clarify: The original (working) pupsave and the (emergency) pupave-may11 were on the system. At this point uPupBB32 was motoring down the highway, motor purring, me singing. Then! (silly me! silly, silly, silly me!) I began messed around formatting, partitioning, installing and running different puppies. Slack puppies. Xenial puppies. Stretched Puppies. You know pretty well what I did. Some-how, somewhere in the process, Puppy Linux found the 'hidden' save file and 'lost' the original pupsave file. Now my working save file was (and to this day is) pupsave-may11. It wasn't a complete disaster, but I lost a small amount of work.

See what I did? I failed to understand (and use) a standard operating practice. Specifically there is a tool in the menu for backing up the save file. Did I use that? No! Did I lose my work? Yes - a little. Had I used the afore-mentioned method to save (and restore) describe in the para above? Yes, but ONLY with the same, single version of uPupBB32. I think I should stop here because I am now abusing the forum by posting in the wrong section. I am no longer writing on the original topic. I have made my point.

As for my original post - I solved my problem and 'thank you' to everyone that helped.

Tnx and ttfn
cobaka.

собака --> это Русский --> an old dog
"so-baka" (not "co", as in coast or crib).

Post Reply

Return to “Programming”